"Erik Johnson" <ej at wellkeeper dot com> wrote:

> There's more than one way to do it! (Oh, sorry, that's Perl...)
> 
> The two most standard ways would be to call strip() on your string to
> get one sans both leading and trialing whitespace
> 
>     print h.strip()
> 
> or if you know exactly what you've got (i.e., the newline you don't
> want is just the last character), you can just get rid of it:
> 
>     h = h[:-1]

Or if you don't know for sure it's there, but don't want to lose other 
whitespace:

print h.rstrip('\n')

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to