specify end of line character for readline

Ian Kelly ian.g.kelly at gmail.com
Tue May 15 02:29:01 EDT 2012


On Fri, May 11, 2012 at 1:32 PM, Jason <jason at deadtreepages.com> wrote:
> Is there any way to specify the end of line character to use in file.readline() ?
>> I would like to use '\r\n' as the end of line and allow either \r or \n by itself within the line.

In Python 3 you can pass the argument newline='\r\n' to the open
function when you open the file. I don't know of anything comparable
in Python 2.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /