First program
Phil Hansen
phil at gmail.co.za
Sat Jun 12 07:33:56 EDT 2010
On Sat, 12 Jun 2010 12:51:18 +0200, Peter Otten wrote:
> Phil H wrote:
>> The script was written using Gedit on Ubuntu.
>
> Strange. Did you perhaps start with a file that you got from elsewhere
> and modified that? Gedit may have left the CRs untouched then.
>
>> Cannot find a setting in Gedit to set the line ending but it must be
>> there somewhere so will keep looking.
Found it. When using 'save as' there is an option box at the bottom where
you can select the line ending. Simple when you know how :)
>> Also how do you see or check the line endings of a file?
>
> cat -v filename
> is one option. CR (or "\r", or chr(13), or carriage return) shows up as
> ^M. The ^ means "subtract 64 from the byte value", e. g.
> ^M = chr(ord("M")-64) = chr(77-64) = chr(13)
> Peter
Thanks for the help
Cheers
Phil
More information about the Python-list
mailing list