[Tutor] Problem Moving Python Program From WIndows to Linux

Kalle Svensson kalle@gnupung.net
Tue, 10 Apr 2001 12:59:56 +0200


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
-- 
Email: kalle@gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]