Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34669

Re: Problem with print and output to screen

Newsgroups comp.lang.python
Date 2012-12-11 16:44 -0800
References <37e2ba70-a709-4888-9672-be30956d690d@googlegroups.com> <CAPM-O+yJr17oCES1EVysx2Ht4VS3Z940T86xc_mZ_H0AN2eZ7A@mail.gmail.com> <50C7BB20.2020701@davea.name> <mailman.756.1355267237.29569.python-list@python.org>
Subject Re: Problem with print and output to screen
From Mike <miguelcoam@gmail.com>
Message-ID <mailman.760.1355273810.29569.python-list@python.org> (permalink)

Show all headers | View raw


El martes, 11 de diciembre de 2012 20:07:09 UTC-3, Joel Goldstick  escribió:
> On Tue, Dec 11, 2012 at 6:00 PM, Dave Angel <d...@davea.name> wrote:
> 
> 
> On 12/11/2012 05:53 PM, Joel Goldstick wrote:
> 
> > When you read the file line by line the end of line character is included
> 
> > in the result
> 
> >
> 
> > try user[:-1] instead to strip the return from your printed text
> 
> >
> 
> 
> 
> The catch to that is the last line in the file might not have a
> 
> newline.  In that case, we'd be ignoring the last character of the line.
> 
> 
> 
> The .rstrip() method is easy, and for most purposes equivalent.  Few
> 
> text files have trailing whitespace, but many are missing the final
> 
> linefeed.
> 
> 
> 
> Point taken.  Brain freeze.  I forgot about .rstrip.  That is the way to go
> 
> 
> 
> --
> 
> 
> 
> DaveA
> 
> 
> 
> 
> 
> 
> -- 
> Joel Goldstick

Thank you very much, i used  "user.rstrip" and the output is correct . 

Best Regards!

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Problem with print and output to screen Mike <miguelcoam@gmail.com> - 2012-12-11 14:31 -0800
  Re: Problem with print and output to screen Dave Angel <d@davea.name> - 2012-12-11 17:48 -0500
  Re: Problem with print and output to screen Joel Goldstick <joel.goldstick@gmail.com> - 2012-12-11 17:53 -0500
  Re: Problem with print and output to screen Dave Angel <d@davea.name> - 2012-12-11 18:00 -0500
  Re: Problem with print and output to screen Joel Goldstick <joel.goldstick@gmail.com> - 2012-12-11 18:07 -0500
    Re: Problem with print and output to screen Mike <miguelcoam@gmail.com> - 2012-12-11 16:44 -0800
    Re: Problem with print and output to screen Mike <miguelcoam@gmail.com> - 2012-12-11 16:44 -0800

csiph-web