python - 'NoneType' object has no attribute 'group' - Stack ...
stackoverflow.com › questions › 15080078Feb 26, 2013 · Feb 26 '13 at 2:13. Add a comment |. 4. You use regexto match the url, but it can't match, so the result is None. and Nonetype doesn't have the groupattribute. You should add some code to detectthe result. If it can't match the rule, it should not go on under code. def getVideoUrl(content): fmtre = re.search('(?<=fmt_url_map=).*', content) if fmtre is None: return None # if fmtre is None, it prove there is no match url, and return None to tell the calling function ...