python - type function problem
迷茫
迷茫 2017-05-24 11:35:27
0
1
532
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
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
仅有的幸福

What is the python version, 2.x or 3.x? If it is 3.x, change the code to:

print(type(ii)).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template