python equiv of perl's split?
lac at strakt.com
Mon Jan 13 17:03:00 CET 2003
> >>>> import re re.split("(:)", "test:one:two:three")
> > ['test', ':', 'one', ':', 'two', ':', 'three']
> Doh! I didn't realize there was a split in the 're' module, I was
> using the one from the 'string' module.
If your python is recent (2.something) you didn't need to import
the string module, because there are now string methods. It is there
for backwards compatibility.
More information about the Python-list