Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'output': 0.04; 'trailing': 0.07; 'ignoring': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'dec': 0.15; '6:00': 0.16; 'escribi\xf3:': 0.16; 'regards!': 0.16; 'subject:Problem': 0.16; 'subject:screen': 0.16; 'wrote:': 0.17; 'strip': 0.22; 'purposes': 0.23; 'cc:no real name:2**0': 0.24; "we'd": 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'cc:addr:gmail.com': 0.27; 'cc:2**2': 0.27; 'forgot': 0.27; 'correct': 0.28; 'equivalent.': 0.29; 'case,': 0.29; 'character': 0.29; 'included': 0.29; 'point': 0.31; 'file': 0.32; '11,': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'method': 0.36; 'subject:with': 0.36; 'thank': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'instead': 0.39; 'skip:" 10': 0.40; 'end': 0.40; 'your': 0.60; 'most': 0.61; 'much,': 0.84; 'received:209.85.216.184': 0.84; 'joel': 0.91; 'angel': 0.93 Newsgroups: comp.lang.python Date: Tue, 11 Dec 2012 16:44:38 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=201.241.14.126; posting-account=8p6uswoAAAAUObi1PYaOvnrSv6dgwhRh References: <37e2ba70-a709-4888-9672-be30956d690d@googlegroups.com> <50C7BB20.2020701@davea.name> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 201.241.14.126 MIME-Version: 1.0 Subject: Re: Problem with print and output to screen From: Mike To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" , d@davea.name, Mike 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: , Message-ID: Lines: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355273810 news.xs4all.nl 6896 [2001:888:2000:d::a6]:39668 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34669 El martes, 11 de diciembre de 2012 20:07:09 UTC-3, Joel Goldstick escribi= =F3: > On Tue, Dec 11, 2012 at 6:00 PM, Dave Angel wrote: >=20 >=20 > On 12/11/2012 05:53 PM, Joel Goldstick wrote: >=20 > > When you read the file line by line the end of line character is includ= ed >=20 > > in the result >=20 > > >=20 > > try user[:-1] instead to strip the return from your printed text >=20 > > >=20 >=20 >=20 > The catch to that is the last line in the file might not have a >=20 > newline. =A0In that case, we'd be ignoring the last character of the line= . >=20 >=20 >=20 > The .rstrip() method is easy, and for most purposes equivalent. =A0Few >=20 > text files have trailing whitespace, but many are missing the final >=20 > linefeed. >=20 >=20 >=20 > Point taken.=A0 Brain freeze.=A0 I forgot about .rstrip.=A0 That is the w= ay to go >=20 >=20 >=20 > -- >=20 >=20 >=20 > DaveA >=20 >=20 >=20 >=20 >=20 >=20 > --=20 > Joel Goldstick Thank you very much, i used "user.rstrip" and the output is correct .=20 Best Regards!