usr bin python2 import re match_str cos 222 7233432 sin 244 3456 tg 23

1
2
3
4
5
6
7
8
#!/usr/bin/python2.5
import re
match_str = u'cos(222.7233432) + sin(244.3456) / tg(233.2333)'
print [u'%.2f' % float(x) for x in re.findall(r'\d+\.\d+', match_str)]
f = u'23333.2344'
f = u'%.2f' % float(f)
print f