[Tutor] Carriage return

Alan Gauld alan.gauld at btinternet.com
Mon Oct 12 09:52:16 CEST 2009


"Vineet Kothari" <vineet.kothari at gmail.com> wrote

> I see that python IDLE add ^M as carriage return while programming in
> windows machine.

Thats just the Windows line ending.
If you want to use the same file on both Windowscand Linux then
you will need to either get used to it or run the DOS2Unix tool
(and UNIX2DOS going back to Windows).

> Can anyone help me as I use IDLE & I need to remove ^M from the end of 
> every
> line. Though it is not shown while programming but I can see that when I 
> run
> my scripts on debian linux environment & thus get errors.

It shouldn't cause any faults in the programs when they run, it is
just a nuisance when working in the editor. Some editors are intelligent
enough to deal with this transparently - eg. I think vim and Scite both do 
this.
If you regularly edit on both OS then it might be worth moving from IDLE
to one of those editors.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list