[Tutor] Parsing string with variable length delimiter?

Jeffrey F. Bloss jbloss at alltel.net
Thu Sep 9 17:46:40 CEST 2004


On 9/9/04 3:58 PM +0200, Michael Janssen wrote:

> even more: when you need the second optional argument maxsplit, you
> can reenable the nice default behaviour with None. Instead of a lame
>
> aString.split(" ", 1)
>
> you can do
>
> aString.split(None, 1)

for words in range(len(soapbox)):

Ya' know, I've been a "hack" for a long time, using C and other odd script 
languages to automate this or simplify that, or just get some job done that 
nothing else seem to do the way I want it done. I picked up Python maybe 
two months ago and love it. Spent a bunch of hours cobbling together a few 
little projects, learning by trial and error, and searching the docs. But I 
honestly think I've gained more useful knowledge reading this list in a 
couple weeks than I could have in many more months of hit and miss. The 
None thing is a prime example. Sends my palm sailing towards my forehead 
and makes me mumble things like "should have known that and I bet that 
works over here... and here... and over there dummy". ;)

Ok, enough wasted bandwidth. I just wanted to thank you Michael, and every 
other Snake-God who takes the time to hand hold us clueless newbies. I love 
you guys. <smooch>



More information about the Tutor mailing list