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 2002年06月02日 08:04 by bescoto, last changed 2022年04月10日 16:05 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg11016 - (view) | Author: Ben Escoto (bescoto) | Date: 2002年06月02日 08:04 | |
This has probably been suggested previously because it is so simple, but how about adding a second optional argument to readline()? If present, the second argument would be a string (or possibly just a single character) that marks the end of each line. The default is obviously '\n'. This scheme seems natural enough to me, and would really help when parsing files with null terminated lines. There must be a lot of other uses too. |
|||
| msg11017 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2002年06月02日 13:01 | |
Logged In: YES user_id=21627 That's not simple at all. Python uses the C library's fgets function on some systems, which does not support this feature, either, so you cannot implement it on top of fgets. If you need to deal with different line end conventions on various systems, Python 2.3 offers a Universal Newline Support (PEP 278). For uses beyond that, I recommend to read the entire file, then do .split on the resulting string. This is the common solution to your problem, and it works quite well. |
|||
| msg223994 - (view) | Author: Akira Li (akira) * | Date: 2014年07月25日 20:21 | |
Reincarnation: issue #1152248: Add support for reading records with arbitrary separators to the standard IO stack |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月10日 16:05:22 | admin | set | github: 36685 |
| 2014年07月25日 20:21:08 | akira | set | nosy:
+ akira messages: + msg223994 |
| 2002年06月02日 08:04:43 | bescoto | create | |