AttributeError: ‘tuple‘ object has no attribute ‘group‘
程序员文章站
2022-05-27 12:17:47
...
我的报错内容如下:
打印的地方
具体代码呢,我写了一个demo 如下
import re
content = "abcabcabc"
rex = re.search("c", content).span()
print(rex.group())
错的地方就是 span 和 group 同时使用了 ,所以这里把span 去掉即可
span 是获取坐标的, group 是匹配表达式的字符串的.
正确的写法如下
import re
content = "abcabcabc"
rex = re.search("c", content)
print(rex.group())
print(rex)
上一篇: python随机数
推荐阅读
-
AttributeError: module ‘community‘ has no attribute ‘best_partition‘ 问题解决方法
-
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
-
【Tensorflow】Linux下Tensorflow报错:AttributeError: module ‘tensorflow‘ has no attribute ‘xxxx‘
-
AttributeError: 'module' object has no attribute 'main'
-
AttributeError: module 'sklearn' has no attribute 'linear_model'
-
解决Keras报错AttributeError: 'NoneType' object has no attribute 'inbound_nodes'
-
解决'DataFrame' object has no attribute 'sort'
-
‘MyObject‘ object has no attribute ‘***‘
-
AttributeError: ‘NoneType‘ object has no attribute ‘origin‘解决办法
-
AttributeError: ‘set‘ object has no attribute ‘append‘解决办法