Python的正则表达式模块
1 # -*- coding:utf-8 -*- 2 3 import re 4 text = "JGood is a handsome boy, he is cool, clever, and so on..." 5 m = re.match(r"(\w+)\s", text) 6 if m: 7 print m.group(0), ‘\n‘, m.group(1) 8 else: 9 print ‘not match‘
时间: 2024-10-28 23:31:19