This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年06月21日 20:36 by Tony.Malykh, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| testpy.zip | Tony.Malykh, 2012年06月21日 20:36 | |||
| Messages (2) | |||
|---|---|---|---|
| msg163363 - (view) | Author: Tony Malykh (Tony.Malykh) | Date: 2012年06月21日 20:36 | |
readline() or readlines() method can read the file up to the line where weird character ascii code 26 appears. I would like to read the entire file though. A simple example attached. |
|||
| msg163373 - (view) | Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) | Date: 2012年06月21日 22:05 | |
Your problem is similar to this discussion: http://stackoverflow.com/questions/405058/line-reading-chokes-on-0x1a On Python2, files are based on the fopen() C function, and on Windows files opened in text mode stop reading on the first character 26 (^Z, or EOF) The best solution here is probably to open the file in "universal" mode: f = open("test.txt", "rU") ...Or use Python3, which has a completely new implementation of the open() function. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:31 | admin | set | github: 59334 |
| 2012年06月21日 22:05:46 | amaury.forgeotdarc | set | status: open -> closed nosy: + amaury.forgeotdarc messages: + msg163373 resolution: wont fix |
| 2012年06月21日 20:36:27 | Tony.Malykh | create | |