[Tutor] unpack/regexp

Paul Kraus pkraus at pelsupply.com
Tue Apr 11 17:17:31 CEST 2006


> Python regex is a bit more verbose than Perl but you can do the same thing:
>
> In [2]: import re
>
> In [11]: m=re.match("(.{10})(.{10})(.{13})", line)
>
> In [13]: m.group(1, 2, 3)
> Out[13]: ('1234567890', '1234567890', '123456789012 ')

That work great. Regex tend to be "expensive" is there a "better" way to do 
it?


More information about the Tutor mailing list