简体   繁体   中英

Python: AttributeError: 'NoneType' object has no attribute 'start'

有一个小问题,只是修改了我的python模块以匹配新的html模板,但是如果我使用,则会给我一个错误,在旧模块运行正常的情况下,您能指出我为使用新模块而必须做些什么并更新我的网站模板。

Well, you're matching a different regex:

html_post_start = re.search('<div class="articleline2"></div>', html)

vs

html_post_start = re.search('<div class="excerpt"></div>', html)

One matches, the other doesn't (returning None ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM