In article <[EMAIL PROTECTED]>,
Klaus Alexander Seistrup <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] skrev:
>
>> how can I extract 2 integers from a string in python?
>>
>> for example, my source string is this:
>> Total size: 173233 (371587)
>>
>> I want to extract the integer 173233 and 371587 from that
>> soource string, how can I do that?
>
>E.g.:
>
>#v+
>
>>>> import re
>>>> re.findall(r'\d+', 'Total size: 173233 (371587)')
>['173233', '371587']
>>>>
.
.
.
Nicely expressed.
People doing a lot of report-scraping might also want to
consider one of the scanf implementations for Python.
<URL: http://hkn.eecs.berkeley.edu/~dyoo/python/scanf/ >
has an example.
--
http://mail.python.org/mailman/listinfo/python-list