split up a list by condition?

Grooooops JOHNWUN at aol.com
Mon Jun 6 19:03:22 EDT 2005


Reinhold,
  Thanks for your response in the previous thread.
Yours is an interesting question. I haven't come up with a solution,
but I did realize that in the previous problem, the source 'word'
doesn't really need to stay intact...
So perhaps a solution along these lines?

>>> for a in enumerate(wlist):
... 	if a[1] in vowels:
... 		vees.append(wlist.pop(a[0]))

I don't know if it's possible to cram a 'pop' command into the single
line solution though.

I look forward to seeing other tricks to this end... :)




More information about the Python-list mailing list