在IDLE中运行结果:
Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import bs4
>>>
bs的版本为:
在PyCharm编译器上时报错:
python版本
from bs4 import BeautifulSoup
C:\Users\Administrator\AppData\Local\Programs\Python\Python35\python.exe D:/python/style/style-1/bianliang-01.py
Traceback (most recent call last):
File "D:/python/style/style-1/bianliang-01.py", line 64, in <module>
app.get_content()
File "D:/python/style/style-1/bianliang-01.py", line 45, in get_content
all_h2=self.get_all_h2() #所有的数据都获取出来了
File "D:/python/style/style-1/bianliang-01.py", line 34, in get_all_h2
html = self.get_one_page_html()
File "D:/python/style/style-1/bianliang-01.py", line 27, in get_one_page_html
re = requests.get(self.url, self.headers)
TypeError: get() takes 1 positional argument but 2 were given
Process finished with exit code 1
#这算是成功了还是出错了呢?
@一叶*秋: 导入正确,你程序里传参错误
@北方姆Q: 谢谢你呀,之前也用的是bs4结果不起作用,不过现在好了