Generic string import like in strptime?

Paul Hankin paul.hankin at gmail.com
Wed Jan 16 11:10:35 EST 2008


On Jan 16, 8:34 am, Andre <j... at hrz.tu-chemnitz.de> wrote:
> Hi there
>
> Is there a function like strptime, which takes a string and converts it
> into an array depending on a format string I provide. Like:>>> a = '3456\tblub-blib.0.9'
> >>> b = '%d\t%s-%s.%f'
> >>> c = mysticalfunction(a,b)
> >>> print c
>
> [3456,'blub','blib',0.9]

Use regular expressions: see http://docs.python.org/lib/node49.html

--
Paul Hankin



More information about the Python-list mailing list