interactive help on string functions - howto

Steven Bethard steven.bethard at gmail.com
Wed Sep 29 14:32:56 EDT 2004


Jeremy Jones <zanesdad <at> bellsouth.net> writes:
> Make sure you've imported string.

No need to import string, you can use the builtin str:

>>> help(str.rstrip)
Help on method_descriptor:

rstrip(...)
    S.rstrip([chars]) -> string or unicode
    
    Return a copy of the string S with trailing whitespace removed.
    If chars is given and not None, remove characters in chars instead.
    If chars is unicode, S will be converted to unicode before stripping

>>> help(str.ljust)
Help on method_descriptor:

ljust(...)
    S.ljust(width[, fillchar]) -> string
    
    Return S left justified in a string of length width. Padding is
    done using the specified fill character (default is a space).


Steve




More information about the Python-list mailing list