import requests
res=requests.get('http://news.sina.com.cn/china/')
res.encoding="utf-8"
#print(res.text)
from bs4 import BeautifulSoup
soup=BeautifulSoup(res.text,'html.parser')
aa=soup.select('a')
for ii in aa:
print type(ii)
错误信息:SyntaxError: invalid syntax
Apakah versi python, 2.x atau 3.x Jika 3.x, tukar kod kepada: