2014-02-11 105 views

回答

3
import re 
re.findall('\d+','gfgfdAAA1234ZZZsddgAAA4567ZZZuijjk') 
['1234', '4567'] 
1

讓我知道如果我不正確認識你,但你肯定可以提取這些子爲list,雖然你做略有不同:

>>> import re 
>>> text = 'gfgfdAAA1234ZZZsddgAAA4567ZZZuijjk' 
>>> re.findall(r'[0-9]{4}', text) 
['1234', '4567'] 
相關問題