Python 正則re模塊之findall()詳解

1. 先說一下findall()函數的兩種表示形式 import re kk = re.compile(r'\d+') kk.findall('one1two2three3four4') #[1,2,3,4] #注意此處findall()的用法,可傳兩個參數; kk = re.compile(r'\d+') re.findall(kk,"one123") #[1,2,3] 2. 正則表達式可能遇
相關文章
相關標籤/搜索