我正在尝试查找数字后跟小数点和另一个数字的所有组合。最后的决赛中小数点可能会丢失查找可能后跟小数点的所有数字
E.g.,
1.3.3 --> Here there are two combinations 1.3 and 3.3
1.3.3. --> Here there are two combinations 1.3 and 3.3
然而,当我运行下面的代码?
st='1.2.3 The Mismatch of Accommodation and Disparity and the Depths of Focus and of Field'
import re
re.findall('\d\.\d+',st)
['1.2']
我在做什么错?
're.findall('\ d \。\ d *',st)''+'至少需要一个右手数字,在最后一个例子中您没有这个数字。另外,消费数字使得下一个不匹配。 –