您的位置:首页技术文章
文章详情页

python - type函数问题

浏览:35日期: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)).

标签: Python 编程
相关文章: