[Tutor] Problem Moving Python Program From WIndows to Linux

Jethro Cramp jsc@rock-tnsc.com
Wed, 11 Apr 2001 12:08:23 -0800


Kalle Svensson wrote:

> Sez Jethro Cramp:
> 
>> Can you recommend any utilities to strip "\r" from files. I tried doing 
>> search and replace in idle but that failed.
> 
> 
> s = open("afile").read()
> s = s.replace("\r", "")
> open("afile", "w").write(s)
> 
> Will remove all "\r"s from "afile".
> 
> 
>> Also if I do strip all the "\r" will that render the scripts inoperable 
>> under windows?
> 
> 
> I don't think so, but haven't tested.
> 
> Peace,
>   Kalle

Thanks. Worked a treat.

Jethro