Moving around in a string

Peter Otten __peter__ at web.de
Sat Dec 6 13:52:56 CET 2003


Mark Engle wrote:

> I'm also new to Python, but I think I can point you in the right
> direction.  Look into split() in library documentation.
> 
> http://www.python.org/doc/current/lib/module-string.html
> 

One caveat (only for the string module), quoting from the above document,
but easily overlooked:

"Many of the functions provided by this module are also defined as methods
of string and Unicode objects; see ``String Methods'' (section 2.2.6) for
more information on those." 

So whenever you're tempted to write string.somefunc(s, moreargs), rather use
s.somefunc(moreargs).

Peter




More information about the Python-list mailing list