AttributeError: ‘tuple‘ object has no attribute ‘group‘
生活随笔
收集整理的這篇文章主要介紹了
AttributeError: ‘tuple‘ object has no attribute ‘group‘
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我的報錯內容如下:
打印的地方
具體代碼呢,我寫了一個demo 如下
import recontent = "abcabcabc"
rex = re.search("c", content).span()
print(rex.group())
錯的地方就是 span 和 group 同時使用了 ,所以這里把span 去掉即可
span 是獲取坐標的,? group 是匹配表達式的字符串的.
正確的寫法如下
import recontent = "abcabcabc"
rex = re.search("c", content)
print(rex.group())
print(rex)
?
總結
以上是生活随笔為你收集整理的AttributeError: ‘tuple‘ object has no attribute ‘group‘的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python spilt() 方法 ,分
- 下一篇: python 正则表达式 re.sear