getting a process's PID

Duncan Booth duncan.booth at invalid.invalid
Wed Dec 27 12:31:35 EST 2006


"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')




More information about the Python-list mailing list