Message162808
I just tested on Python 3.2, and found something interesting; it seems a ^Z character on a line that has other input read in as a character. Also, other input after an EOF on its own means you still have to do two more EOFs to end.
Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import fileinput
>>> lines = list(fileinput.input())
test
testing
^Z
^Z
>>> lines
['test\n', 'testing\n']
>>> lines = list(fileinput.input())
test
testing^Z
^Z
^Z
>>> lines
['test\n', 'testing\x1a\n']
>>> lines = list(fileinput.input())
testing^Z
test
^Z
testing
^Z
^Z
>>> lines
['testing\x1a\n', 'test\n', 'testing\n']
Also, the documentation for fileinput doesn't mention EOF at all. |
|
Date |
User |
Action |
Args |
2012-06-14 17:14:50 | zach.ware | set | recipients:
+ zach.ware, jaraco, r.david.murray |
2012-06-14 17:14:50 | zach.ware | set | messageid: <1339694090.52.0.605367217878.issue15068@psf.upfronthosting.co.za> |
2012-06-14 17:14:49 | zach.ware | link | issue15068 messages |
2012-06-14 17:14:49 | zach.ware | create | |
|