本帖最后由 wp231957 于 2019-3-28 13:20 编辑
>>> s2=re.findall("\d+\.\d+%|\d+%",s)
>>> print(s2)
['0.8%', '12.5%', '26.8%', '4.1%', '8.6%', '2.1%', '13%', '16.6%', '9.4%', '16.3%', '50.9%', '38.7%', '6.6%', '18.5%', '24.2%', '12.7%', '16.1%', '15.7%', '3.9%', '21.0%', '33.9%', '27.8%', '17.3%', '51.6%']
>>> s2=re.findall("\d{4}年",s)
>>> print(s2)
['1999年', '1999年', '1999年', '1999年', '1999年', '1999年']
>>> s2=re.findall("\d+\.\d+亿元|\d+亿元",s)
>>> print(s2)
['1460.6亿元', '170.9亿元', '543.9亿元', '105.3亿元', '1284.9亿元', '156.5亿元', '654.6亿元', '496.9亿元', '85.1亿元', '567.2亿元', '88.6亿元', '304.6亿元', '59.4亿元', '270.2亿元', '434.8亿元', '357.4亿元', '222.5亿元', '610亿元']
>>>
>>> s2=re.findall("\d+\.\d+ |\d+ ",s) ,s)
>>> print(s2)
['543.9 ', '26.8 ', '168.1 ', '13.2 ', '30.9 ', '272.8 ', '46.9 ', '50.2 ', '52.9 ', '14.4 ', '9.7 ', '355.6 ', '25.5 ', '65.4 ', '188.3 ', '29.3 ', '34.6 ']
>>> |