<分区>
我想从上面的带小数点或不带小数点的字符串中获取所有百分比。 我也想得到 % 符号。
string = """Bachelor of Engineering in Electronics from in 2013 with 60%.
Diploma (Electronics & Video Engineering) from in 2009 with 79.39%.
SSC from in 2006 with 61.71%."""
我试过如下
re.findall(r'\d+%|([0-9]\d?)\.\d+%', string)
获取输出为
['', '79', '61']
但我想要如下输出
['60%', '79.39%', '61.71%']
任何人都可以说出我哪里出错了,并使用正则表达式来获得预期的输出。