Fredrik Lundh a écrit :
> "ownowl" wrote:
> 
> 
>>beginer under python, I have a problem to get lines in a text file.
>>lines have inside the \n (x0A) char, and le readline method split the
>>line at this char too (not only at x0Dx0A).
> 
> 
> that's not a very clever design, at least if you plan to read the files
> from C or compatible languages...
> 
> 
>>for resume, I want to split a file to lines with only those chars : x0Dx0A
>>
>>A idea ?
> 
> 
> the easiest way to do this is to open the file in binary mode, gobble up
> the entire file, and split it yourself:
> 
>     for line in open(filename, "rb").read().split("\r\n"):
>         ...
> 
> </F>

great
thank's
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to