Toy box for grapefruit623
紀錄碰到的技術問題 個人隨筆
2012年8月3日 星期五
python regular expression "match" vs "search"
常常弄混re.match 與 re.search的差別
寫下來以免又忘了。
re.match("pattern","string")是比對該字串的「開頭」是否符合該表示式
re.search("pattern", "string")則尋找string中任何位置是否有相符者
兩者皆回傳MatchObject,若找不到則回傳None
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言