Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'lines,': 0.05; 'reason,': 0.07; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'skip:o 70': 0.16; 'subject:ideas': 0.16; 'subject:program': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'feb': 0.19; "i'd": 0.22; 'header :In-Reply-To:1': 0.25; 'dos': 0.27; 'message-id:@mail.gmail.com': 0.27; 'lines': 0.28; 'convert': 0.29; 'probably': 0.29; 'code': 0.31; '(and': 0.32; 'file': 0.32; 'to:addr:python-list': 0.33; '(with': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'text': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'fun': 0.64; 'experience.': 0.65; '2013': 0.84; 'dozen': 0.91; 'angel': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=kFHT5Y4mP2818WFlCZRnu/TOOPXzv88/r9nkOvUJyzw=; b=bmY7dfG748fiU5IZIAQNB0B7BbT7XUgD/7oYEBcGtCsZe9pfJrfRbwpIQtK8Pr9JQ2 +wNKbedENeyQDKHoMXefCyw/NTP8yQbbV88+RCZDJhc4lA3n7mc1kTumIJmd7cMRkbIT qn3+SJByIeH9tXFFAMTab2MjLA1pCtY6jhhDy9GF5HlZ6KbZioigVX0nkfN1ZLT3sWTS 1cOO4DMsjsJsHCQgwQPlu2U1v+Pn7PZ9zIgrHw9wadQXpEVfEOttcHkfH3/ji4gMBLCN p0545nILanD21oSqXLsrg7IJKrEp6Hq04erJ9NldklDRurrSvtifXL9zmIbEu0KEtNpJ pyuQ== MIME-Version: 1.0 X-Received: by 10.58.50.7 with SMTP id y7mr449675ven.24.1361945904882; Tue, 26 Feb 2013 22:18:24 -0800 (PST) In-Reply-To: <512D7D0F.5060606@davea.name> References: <1cff6513-4d67-4fdc-a86d-945635859683@googlegroups.com> <512D7D0F.5060606@davea.name> Date: Wed, 27 Feb 2013 17:18:24 +1100 Subject: Re: Small program ideas From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361945913 news.xs4all.nl 6870 [2001:888:2000:d::a6]:46209 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40033 On Wed, Feb 27, 2013 at 2:27 PM, Dave Angel 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