简体   繁体   English

AttributeError:'NoneType'对象没有属性'group'错误

[英]AttributeError: 'NoneType' object has no attribute 'group' error

try:
            res = self.browser.open('https://login.facebook.com/login.php?login_attempt=1',form_data)
            response = res.read()
            self.fbid = re.search('https://www.facebook.com/(.*)\?sk=info',response)
            self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))
            self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))
        except urllib2.HTTPError,e :
            print "****exception****inside login  error code: %s" % (e.code)
        res.close()
    except urllib2.HTTPError,e :
         print "****exception****inside login  error code: %s" % (e.code)

    #print " server Response Code: %s " % (res.code)

i got this 我懂了

File "facebotv2.py", line 122, in login
    self.fbid = re.search('https://www.facebook.com/(.*)',self.fbid.group(1))
AttributeError: 'NoneType' object has no attribute 'group'

self.fbid is None after your first regular expression search. 第一次正则表达式搜索后, self.fbidNone This probably means that you didn't find a match. 这可能意味着您找不到匹配项。 If you want to prevent the error, you can conditionally only continue searching the result of the initial search with if self.fbid != None 如果你想防止错误,你可以有条件地只用if self.fbid != None继续搜索初始搜索的结果if self.fbid != None

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python GTTS 错误:AttributeError:'NoneType' 对象没有属性 'group' - Python GTTS Error : AttributeError: 'NoneType' object has no attribute 'group' 奇怪的“AttributeError:‘NoneType’对象没有属性‘组’”错误 - Odd "AttributeError: 'NoneType' object has no attribute 'group'" error AttributeError: 'NoneType' 对象没有属性 'group' , - AttributeError: 'NoneType' object has no attribute 'group' , AttributeError:'NoneType'对象没有属性'group' - AttributeError: 'NoneType' object has no attribute 'group' AttributeError: 'NoneType' object 没有属性 'group - AttributeError: 'NoneType' object has no attribute 'group AttributeError: 'NoneType' object 没有属性 'group' - AttributeError: 'NoneType' object has no attribute 'group' AttributeError: 'NoneType' object 在 googletrans 中没有属性 'group' - AttributeError: 'NoneType' object has no attribute 'group' in googletrans AttributeError:“ NoneType”对象没有属性“ group” {for instagram} - AttributeError: 'NoneType' object has no attribute ‘group’ {for instagram} AttributeError:'NoneType'对象没有属性'group' - AttributeError: 'NoneType' object has no attribute 'group' AttributeError: 'NoneType' 对象没有属性 'group' 问题 - AttributeError: 'NoneType' object has no attribute 'group' problem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM