Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40033
| References | <b785a583-a10d-4203-882f-c09c5610ce75@googlegroups.com> <1cff6513-4d67-4fdc-a86d-945635859683@googlegroups.com> <mailman.2534.1361859347.2939.python-list@python.org> <c136f09a-f5a1-4c21-9c75-45a98ae291a7@googlegroups.com> <512D7D0F.5060606@davea.name> |
|---|---|
| Date | 2013-02-27 17:18 +1100 |
| Subject | Re: Small program ideas |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2594.1361945913.2939.python-list@python.org> (permalink) |
On Wed, Feb 27, 2013 at 2:27 PM, Dave Angel <davea@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Small program ideas eli m <techgeek201@gmail.com> - 2013-02-15 19:22 -0800
Re: Small program ideas Mitya Sirenef <msirenef@lightbird.net> - 2013-02-15 22:52 -0500
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-15 19:57 -0800
Re: Small program ideas Mitya Sirenef <msirenef@lightbird.net> - 2013-02-15 23:19 -0500
Re: Small program ideas Mark R Rivet <markrrivet@aol.com> - 2013-02-16 12:42 -0500
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-15 19:57 -0800
Re: Small program ideas Mark R Rivet <markrrivet@aol.com> - 2013-02-16 12:40 -0500
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-25 19:48 -0800
Re: Small program ideas Dave Angel <davea@davea.name> - 2013-02-26 01:15 -0500
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-26 14:47 -0800
Re: Small program ideas Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-27 00:22 +0000
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-26 16:47 -0800
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-26 16:47 -0800
Re: Small program ideas Dave Angel <davea@davea.name> - 2013-02-26 22:27 -0500
Re: Small program ideas Chris Angelico <rosuav@gmail.com> - 2013-02-27 17:18 +1100
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-02-26 14:47 -0800
Re: Small program ideas "Vytas D." <vytasd2013@gmail.com> - 2013-02-26 13:21 +0000
Re: Small program ideas Neil Cerutti <neilc@norwich.edu> - 2013-02-26 14:32 +0000
Re: Small program ideas Matej Cepl <mcepl@redhat.com> - 2013-02-26 14:21 +0100
Re: Small program ideas eli m <techgeek201@gmail.com> - 2013-03-18 16:51 -0700
Re: Small program ideas Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-19 00:56 +0000
Re: Small program ideas PMT <d12123176@mydit.ie> - 2013-03-28 11:46 -0700
Re: Small program ideas Neil Cerutti <neilc@norwich.edu> - 2013-03-29 13:43 +0000
csiph-web