Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:AttributeError:';非类型';对象没有属性';启动';_Python - Fatal编程技术网

Python:AttributeError:';非类型';对象没有属性';启动';

Python:AttributeError:';非类型';对象没有属性';启动';,python,Python,遇到小问题,刚刚修改了python模块以匹配新的html模板,但如果我使用,则会出现错误,因为旧模块工作正常。您能告诉我如何使用新模块并更新我的网站模板。好吧,您正在匹配不同的正则表达式: html_post_start = re.search('<div class="articleline2"></div>', html) html\u post\u start=re.search(“”,html) vs html\u post\u start=re.search

遇到小问题,刚刚修改了python模块以匹配新的html模板,但如果我使用,则会出现错误,因为旧模块工作正常。您能告诉我如何使用新模块并更新我的网站模板。

好吧,您正在匹配不同的正则表达式:

html_post_start = re.search('<div class="articleline2"></div>', html)
html\u post\u start=re.search(“”,html)
vs

html\u post\u start=re.search(“”,html)

一个匹配,另一个不匹配(返回
None
)。

非常感谢,就是这样,如何使用mutable更改它?编辑:我宁愿更改新的css模板,所以“摘录”将变成“articleline2”。再次感谢您的帮助,爱您-不,不要像那样用Python构建复杂的HTML。它容易出错,而且无法读取。有几种可用的模板语言:您应该使用其中一种。
html_post_start = re.search('<div class="excerpt"></div>', html)