String split

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Tue Mar 28 11:27:46 EST 2006


Peter Otten wrote:
> The documentation for Python 2.4 has a better explanation.
> 

<-cut->

> Quoted after http://docs.python.org/lib/string-methods.html#l2h-202.
> 
> Peter

Thanks, I haven't see it.
Just a question about that "different algorithm", because it force the
developer to do other work for make the "split" result more "logically
compatible":

S = "" # this can become from an external source like config parser

for s n S.split():
   do the work... # don't go inside

that isn't "compatible", so python split it into two different methods
the string, with:

for s n S.split(','):
   do the work... # run one time into this


Michele



More information about the Python-list mailing list