我正在嘗試查找數字後跟小數點和另一個數字的所有組合。最後的決賽中小數點可能會丟失查找可能後跟小數點的所有數字
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)''+'至少需要一個右手數字,在最後一個例子中您沒有這個數字。另外,消費數字使得下一個不匹配。 –