re.search - Pattern matching review ( Apologies re sending)
Ganesh Pal
ganesh1pal at gmail.com
Sun May 29 02:23:36 EDT 2016
> Perhaps:
> map(int, re.search(search_pat, stdout).groups())
>
>
>
Thanks Albert map saved me many lines of code but map returns a list I
will have to convert the list to string again
Below is how Iam planning to teh conversion
>>> block = map(int, re.search(search_pat, stdout).groups())
>>> print block
['1,2:122']
>>> s1 = ','.join(str(n) for n in block)
>>> print s1
1,2:122
>>> str(s1)
'1,2:122'
Regards,
Ganesh
More information about the Python-list
mailing list