pattern = re.compile(r'\w+\s*=\s*[0-9]*.[0-9]*\s*')
lists = pattern.findall(s)
print lists
['a=4 ', 'b=3.4 ', 'c=4.5']
On Wed, Apr 11, 2007 at 06:10:07PM -0700, Qilong Ren wrote:
> Hi, everyone,
>
> I am extracting some information from a given string using python RE. The
> string is ,for example,
I cut from Sam Python Phrasebook
"Converting Unicode to Local Strings"
import string locStr = "El "
uniStr = u"Ni\u00F1o"
print uniStr.encode('utf-8')
print uniStr.encode('utf-16')
print uniStr.encode('iso-8859-1')
#Combine local and unicode results
#in new unicode string
newStr = locStr+un