Heim  >  Fragen und Antworten  >  Hauptteil

Python - Typfunktionsproblem

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
迷茫迷茫2705 Tage vor486

Antworte allen(1)Ich werde antworten

  • 仅有的幸福

    仅有的幸福2017-05-24 11:37:27

    python版本是什么, 2.x 还是3.x, 如果是3.x , 代码改成:

    print(type(ii)).
    
    

    Antwort
    0
  • StornierenAntwort