Re: File Object behavior

2007-04-04 Thread Bruno Desthuilliers
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

Re: File Object behavior

2007-04-03 Thread Michael Castleton
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 is a carriage >> return >> + >> li

Re: File Object behavior

2007-04-03 Thread Bruno Desthuilliers
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

Re: File Object behavior

2007-04-03 Thread Michael Castleton
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://

Re: File Object behavior

2007-04-03 Thread 7stud
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

Re: File Object behavior

2007-04-03 Thread 7stud
On Apr 3, 12:02 pm, Michael Castleton <[EMAIL PROTECTED]> 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

Re: File Object behavior

2007-04-03 Thread Steven Bethard
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