Small program ideas
Chris Angelico
rosuav at gmail.com
Wed Feb 27 01:18:24 EST 2013
On Wed, Feb 27, 2013 at 2:27 PM, Dave Angel <davea at davea.name> wrote:
> But to convert a DOS text file (with lines ending cr/lf) into a Unix text
> file (with lines ending lf) would be a dozen lines, shrinkable to 3 with
> lots of experience. (And I'd probably prefer the dozen line version)
Code golf!
open("outfile","wb").write(open("infile","rb").read().replace("\r",""))
No particular reason, and I'd probably prefer a 3-6 line version of
it, but it's fun to do it as one :)
ChrisA
More information about the Python-list
mailing list