文章詳情頁
python - type函數問題
瀏覽:83日期:2022-06-30 10:34:48
問題描述
import requestsres=requests.get(’http://news.sina.com.cn/china/’)res.encoding='utf-8'#print(res.text)from bs4 import BeautifulSoupsoup=BeautifulSoup(res.text,’html.parser’)aa=soup.select(’a’)for ii in aa: print type(ii)錯誤信息:SyntaxError: invalid syntax
問題解答
回答1:python版本是什么, 2.x 還是3.x, 如果是3.x , 代碼改成:
print(type(ii)).
相關文章:
1. css3 - transition屬性當鼠標一開的時候設置的時間不起作用2. javascript - history.replaceState()無法改變query參數3. 前端 - html5 audio不能播放4. html - CSS元素優(yōu)先級的問題.5. javascript - 有什么工具可以自動給css3的樣式 加 前綴 要最簡單的 不會sass less6. javascript - 關于禁用文本選擇與復制的問題7. html - 移動端radio無法選中8. html5 - 如何實現圖中的刻度漸變效果?9. css - 怎么實現一個圓點在一個范圍內亂飛10. css - 關于偽類背景問題
排行榜
