Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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 获取文本不';我不能为div标签工作_Python_Html_Python 3.x_Beautifulsoup - Fatal编程技术网

Python 获取文本不';我不能为div标签工作

Python 获取文本不';我不能为div标签工作,python,html,python-3.x,beautifulsoup,Python,Html,Python 3.x,Beautifulsoup,我正在浏览这个网站: 我想知道代币销售结束的日期,即“2月14日”。它存储在一个div标签中,该标签的类为“sale date”。但是,当我在这个div标记上调用“.get_text”时,我得到以下结果: <bound method Tag.get_text of <div class="sale-date">14 February</div>> 还有其他方法可以提取div标记中的文本吗?试试这个。您忘了在的末尾使用()。get_text应该是。get_te

我正在浏览这个网站:

我想知道代币销售结束的日期,即“2月14日”。它存储在一个div标签中,该标签的类为“sale date”。但是,当我在这个div标记上调用“.get_text”时,我得到以下结果:

<bound method Tag.get_text of <div class="sale-date">14 February</div>>

还有其他方法可以提取div标记中的文本吗?

试试这个。您忘了在
的末尾使用
()
。get_text
应该是
。get_text()


试试这个。您忘了在
的末尾使用
()
。get_text
应该是
。get_text()

更改:

date = pt1.find(class_= "sale-date").get_text
致:

date = pt1.find(class_= "sale-date").get_text()   
更改:

date = pt1.find(class_= "sale-date").get_text
致:

date = pt1.find(class_= "sale-date").get_text()