Nsutton macrumors member Original poster Dec 29, 2009 92 0 6 Feet Under Apr 16, 2010 #1 When writing to a file, how do you tell python to format the text and enter to the next line? -Thanks
When writing to a file, how do you tell python to format the text and enter to the next line? -Thanks
chown33 Moderator Staff member Aug 9, 2009 11,208 9,228 A sea of green Apr 16, 2010 #2 http://www.penzilla.net/tutorials/python/fileio/
Bostonaholic macrumors 6502 Aug 21, 2009 439 0 Columbus, Ohio Apr 16, 2010 #3 Nsutton said: When writing to a file, how do you tell python to format the text and enter to the next line? -Thanks Click to expand... I don't know what you mean by "format the text". Newlines are different for linux/mac vs. windows/dos For *nix systems, including Mac Code: print("This is on the first line \n and this is on the second.") For Windows/DOS machines Code: print("This is on the first line \r\n and this is on the second.")
Nsutton said: When writing to a file, how do you tell python to format the text and enter to the next line? -Thanks Click to expand... I don't know what you mean by "format the text". Newlines are different for linux/mac vs. windows/dos For *nix systems, including Mac Code: print("This is on the first line \n and this is on the second.") For Windows/DOS machines Code: print("This is on the first line \r\n and this is on the second.")
Nsutton macrumors member Original poster Dec 29, 2009 92 0 6 Feet Under Apr 16, 2010 #4 Bostonaholic that works. thanks!
C chuckles:) macrumors 6502 May 3, 2006 283 0 CANADA Apr 20, 2010 #5 You can also add the newline character (\n) to the end of your line. For instance: writeline("Hello.\n") will result in a new line at the \n point.
You can also add the newline character (\n) to the end of your line. For instance: writeline("Hello.\n") will result in a new line at the \n point.