Michael Castleton a écrit :
>
>
> Bruno Desthuilliers wrote:
>> Michael Castleton a écrit :
>>> When I open a csv or txt file with:
>>>
>>> infile = open(sys.argv[1],'rb').readlines()
>>> or
>>> infile = open(sys.argv[1],'rb').read()
>>>
>>> and then look at the first few lines of the file there
//mail.python.org/mailman/listinfo/python-list
>
>
Bruno,
No particular reason in this case. It was probably as a holdover from using
the csv module in the past. I'm wondering though if using binary on very
large
files (>100Mb) would save any processing time - no conversion to
Michael Castleton a écrit :
> When I open a csv or txt file with:
>
> infile = open(sys.argv[1],'rb').readlines()
> or
> infile = open(sys.argv[1],'rb').read()
>
> and then look at the first few lines of the file there is a carriage return
> +
> line feed at the end of each line - \r\n
Is ther
Thank you to both Steve and 7stud. You were right on with binary flag!
I thought I had tried everything...
Mike
--
View this message in context:
http://www.nabble.com/File-Object-behavior-tf3520070.html#a9825806
Sent from the Python - python-list mailing list archive at Nabble.com.
--
http
On Apr 3, 12:26 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> The file.writelines() documentation says that it
> doesn't add line separators. Is adding a carriage return something
> different?
No.
> Is this expected behavior?
According to Python in a Nutshell(p. 217), it is. On windows, in
text
mode
that it
> doesn't add line separators. Is adding a carriage return something
> different?
> At this point I have to filter out the additional carriage return which
> seems like
> extra and unnecessary effort.
> I am using Python 2.4 on Windows XP sp2.
> Can anybody help me unde
Michael Castleton wrote:
> When I open a csv or txt file with:
>
> infile = open(sys.argv[1],'rb').readlines()
> or
> infile = open(sys.argv[1],'rb').read()
>
> and then look at the first few lines of the file there is a carriage return
> +
> line feed at the end of each line - \r\n
> This is f
iage return which
seems like
extra and unnecessary effort.
I am using Python 2.4 on Windows XP sp2.
Can anybody help me understand this situation?
Thanks
--
View this message in context:
http://www.nabble.com/File-Object-behavior-tf3520070.html#a9821538
Sent from the Python - python-list