1. 匹配字符串中的一个百分比数字
import re
t = \'yuchen is a very lovely girl. 5.568% company ltd.\'
match = re.search(r"\d+\.\d*%", t)
print(match.group())
2.匹配小括号()里面的内容
# 这种方式的输出是列表类型, 不包含括号本身
import re
t = \'(123, "345")\'
match = re.findall( r"[(](.*)[)]", t )
print(match)
3.匹配字符串中的一个数字
import re
t = \'123 entity\'
match = re.search(r"\d+", t )
print(match.group())