interactive help on string functions - howto
Helmut Jarausch
jarausch at skynet.be
Wed Sep 29 16:15:12 EDT 2004
Many thanks for the hint.
Still I wonder why I have to prefix it with 'str.'
I don't need to import str and I don't need to prefix rstrip
with 'str.' to USE it - why do I have to do so with HELP then?
Steven Bethard wrote:
> 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).
>
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
More information about the Python-list
mailing list