Traceback (most recent call last):
File "redact.py", line 100, in <module>
match = int(re.match(r'\d+', number).group())
AttributeError: 'NoneType' object has no attribute 'group'
输入=(1,2)(5,2)(5,2)(14,2)(17,2)(17,2)(1,3)(5,3)(5,3)(14,3)(17,3)(17,3)(17,3)(1,4)(5,4)(8,4)(9,4)(9,4)(10,4)(11,4)(14,4)(17,4)(20,4)(20,4)(21,4)(22,4)(22,4)(23,4)(23,4)(1,5)(2,5)(3,5)(4,5)(5)(5,5)(5)(5)(5)(5)(5)(8,5)(9,5)(10,5)(11,5)(11,5)(14,5)(17,5)(20,5)(21,5)(22,5)(22,5)(23,5)(23,(8,6)(9,6)(10,6)(11,6)(14,6)(17,6)(20,6)(23,6)(1,7)(5,7)(8,7)(9,7)(14,7)(17,7) (20,7)(21,7)(22,7)(23,7)(1,8)(5,8)(8,8)(9,8)(10,8)(11,8)(14,8)(17,8)(20,8)(21,8)(22,8)(23,8)
输出=>以上错误 这是我在执行以下代码后收到的错误消息:
^{pr2}$它正在搜索的字符串是:“5’,’,5’,’,6’,’,3’,”。在两个不同的在线regex生成器上,上面的regex非常适合字符串。为什么它适用于X坐标而不是Y坐标?密码完全一样!在
(顺便说一下,我试图从字符串中获取整数)。在
谢谢
不需要正则表达式:
变量
str1
的内容是什么???在re.match(r'\d+', number)
返回{number
与正则表达式不匹配,请检查依赖于str1
的变量{每个正则表达式都必须一步一步地测试,请尝试一些regex web工具,如this来测试它们。在
将regex更改为:
regex = "\b([0-9]+)\,\s\b"
这将创建两个列表一个包含所有第一个元素,另一个包含所有第二个元素。在
相关问题 更多 >
编程相关推荐