Message214952
| Author |
brandon-rhodes |
| Recipients |
brandon-rhodes |
| Date |
2014年03月27日.13:42:43 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1395927763.6.0.283357087125.issue21075@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In Python 3, fileinput.input() returns str lines whether the data is
coming from stdin or from a list of files on the command line. But if
input(mode='rb') is specified, then its behavior becomes inconsistent:
lines from stdin are delivered as already-decoded strings, but data
from files is delivered (correctly) as bytes.
The solution may be that, if a "b" is anywhere in the mode, then input()
should read from the bytes stdin.buffer data source instead of from
stdin.
Otherwise the "rb" mode is rather useless since you can wind
up getting text from it anyway depending on how you are invoked. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年03月27日 13:42:43 | brandon-rhodes | set | recipients:
+ brandon-rhodes |
| 2014年03月27日 13:42:43 | brandon-rhodes | set | messageid: <1395927763.6.0.283357087125.issue21075@psf.upfronthosting.co.za> |
| 2014年03月27日 13:42:43 | brandon-rhodes | link | issue21075 messages |
| 2014年03月27日 13:42:43 | brandon-rhodes | create |
|