Nsutton macrumors member Original poster 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
Bostonaholic macrumors 6502 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.")
C chuckles:) macrumors 6502 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.