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
仅有的幸福2017-05-24 11:37:27
What is the python version, 2.x or 3.x? If it is 3.x, change the code to:
print(type(ii)).