[Tutor] Re: .....str.count and str.split/solved

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri May 7 19:38:59 EDT 2004

On Fri, 7 May 2004, Tim Johnson wrote:

> This was caused by not taking into consideration the differences in line
> enders between linux,windows and Mac, and compounded by processing on
> linux what is produced in windows.
> I need to whip up a read_lines routine for python that's as predicatable
> as the read/lines routine in rebol.

[bringing tutor at python.org back to CC]

Hi Tim,

Ah!  You probably don't need to do anything too special.  If you open the
file in "universal newline" mode, then Python will automagically handle
platform-specific newline stuff.  See:


Look at the 'U' mode for universal newlines --- I think it should do what
you want.

Hope this helps!

More information about the Tutor mailing list