k = 'a bunch of data and then name ""Serpin-ps""'
print re.search(r'name\s""(\w+)""',k).group(1)
给出:
AttributeError: 'NoneType' object has no attribute 'group'
期望输出='Serpin-ps'
有道理,因为文本中有一个“-”。
反正有没有让正则表达式将“-”与所有其他字母数字字符结合起来?
k = 'a bunch of data and then name ""Serpin-ps""'
print re.search(r'name\s""(\w+)""',k).group(1)
给出:
AttributeError: 'NoneType' object has no attribute 'group'
期望输出='Serpin-ps'
有道理,因为文本中有一个“-”。
反正有没有让正则表达式将“-”与所有其他字母数字字符结合起来?