Re: specify end of line character for readline

2012-05-15 Thread Ian Kelly
On Fri, May 11, 2012 at 1:32 PM, Jason ja...@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.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: specify end of line character for readline

2012-05-15 Thread Serhiy Storchaka

On 15.05.12 09:29, Ian Kelly wrote:

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.


io.open supports newline argument.

--
http://mail.python.org/mailman/listinfo/python-list


specify end of line character for readline

2012-05-14 Thread Jason
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.

Thanks,

Jason
-- 
http://mail.python.org/mailman/listinfo/python-list