\r\n or \n notepad editor end line ???

2009-09-09 Thread Sphoorti.Patil
Hey Terry, That was a very useful tip I got about the Escape Sequences.. \r and \n Regards, Sphoorti Digambar Patil Software Engineer * SunGard * Technology Services * Embassy Icon 3, Infantry Road, Bangalore India * HOME - (205)969-1798*Tel +91-80--0501 * Extn 3154 * Fax +91-80

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Fredrik Lundh
John Machin wrote: > Many people don't appear to want to know why; they only want a solution > to what they perceive to be their current problem. and many people can identify a short HOWTO when they see it, and look things up in the documentation when they want the full story. reposting the docu

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Peter Hansen
Steven D'Aprano wrote: > So going back to the original question... if I open in "r" mode a text > file which was created under Windows, I will get \r characters in the > text and have to deal with them regardless of what platform I am running > Python under. Correct? Almost, but the way you phrase

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread John Machin
Steven D'Aprano wrote: > On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote: > > >><[EMAIL PROTECTED]> wrote: >> >> >>>It means in windows we should use 'wb' to write and 'rb' to read ? >>>Am I right? >> >>no. >> >>you should use "wb" to write *binary* files, and "rb" to read *binary* >>file

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Steven D'Aprano
On Mon, 13 Jun 2005 10:52:52 -0400, Peter Hansen wrote: > Steven D'Aprano wrote: >> When you read a Windows text file using "r" mode, what happens to the \r >> immediately before the newline? Do you have to handle it yourself? Or will >> Python cleverly suppress it so you don't have to worry about

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Terry Hancock
On Monday 13 June 2005 09:34 am, Steven D'Aprano wrote: > On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote: > > <[EMAIL PROTECTED]> wrote: > >> It means in windows we should use 'wb' to write and 'rb' to read ? > >> Am I right? > > no. > > you should use "wb" to write *binary* files, and "rb

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Peter Hansen
Steven D'Aprano wrote: > When you read a Windows text file using "r" mode, what happens to the \r > immediately before the newline? Do you have to handle it yourself? Or will > Python cleverly suppress it so you don't have to worry about it? > > And when you write a text file under Python using "w

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Steven D'Aprano
On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote: > <[EMAIL PROTECTED]> wrote: > >> It means in windows we should use 'wb' to write and 'rb' to read ? >> Am I right? > > no. > > you should use "wb" to write *binary* files, and "rb" to read *binary* > files. > > if you're working with *t

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > It means in windows we should use 'wb' to write and 'rb' to read ? > Am I right? no. you should use "wb" to write *binary* files, and "rb" to read *binary* files. if you're working with *text* files (that is, files that contain lines of text separated by line separa

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Greg Ewing
Peter Hansen wrote: > (I don't believe there's a "wU" and conceptually it's sort > of meaningless anyway, If we ever get quantum computers, presumably "wU" will write the newlines in all possible formats simultaneously... -- Greg Ewing, Computer Science Dept, University of Canterbury, C

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread [EMAIL PROTECTED]
Hello All, Thanks for the response. I use mysql and find something strange lately while load text file to my database table using LINES TERMINATED BY '\r\n', And I found that mysql think I have '\r\r\n'. this is happened because in one of my code I use 'w' to write element of string + '\r\n'. no

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > It means in windows we should use 'wb' to write and 'rb' to read ? > Am I right? There is a conceptual difference between "text" files and other files (which are lumped under the label "binary"). Binary files have any kind of data in them (bytes from 0 to 255) and no

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Simon Brunning
On 8 Jun 2005 06:44:40 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > It means in windows we should use 'wb' to write and 'rb' to read ? > Am I right? It depends what you are trying to do with the file. If you are processing it as a text file, open it as a text file, and all will be well:

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread [EMAIL PROTECTED]
Hello thanks everyone, It means in windows we should use 'wb' to write and 'rb' to read ? Am I right? pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Bill Mill
On 8 Jun 2005 06:24:05 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I use windows notepad editor to write text. > > For example I write (in d:\myfile.txt): > Helo > World > > If I open it with python: > FName = open(d:\myfile.txt,'r') > h = FName.readlines() > print h >

Re: \r\n or \n notepad editor end line ???

2005-06-08 Thread Max M
[EMAIL PROTECTED] wrote: > Hello, > > I use windows notepad editor to write text. > > For example I write (in d:\myfile.txt): > Helo > World > > If I open it with python: > FName = open(d:\myfile.txt,'r') > h = FName.readlines() > print h > > I get h : ['Helo\n', 'World'] > > I thought n

\r\n or \n notepad editor end line ???

2005-06-08 Thread [EMAIL PROTECTED]
Hello, I use windows notepad editor to write text. For example I write (in d:\myfile.txt): Helo World If I open it with python: FName = open(d:\myfile.txt,'r') h = FName.readlines() print h I get h : ['Helo\n', 'World'] I thought notepad use \r\n to to end the line. What's wrong with it