【发布时间】:2014-05-05 11:10:19
【问题描述】:
我在创建匹配组以使用 python 从字符串中提取两个值时遇到问题
这是我的意见:
# SomeKey: Value Is A String
我希望能够使用 python 匹配组/正则表达式语句提取 SomeKey 和 Value Is A String。这是我目前所拥有的
import re
line = "# SomeKey: Value Is A String"
mg = re.match(r"# <key>: <value>", line)
【问题讨论】:
标签: python regex string string-matching