文章详情页
新手 - Python 爬虫 问题 求助
浏览:288日期:2022-06-26 16:21:19
问题描述
问题描述: ValueError:unsupported format character ’j’ (0x6a) at index 21即倒数第6行 .jpg j出什么问题了???import urllib.requestfrom bs4 import BeautifulSoupdef get_content(url):
html = urllib.request.urlopen(url)content = html.read().decode(’utf-8’)html.close()return content
def get_image(info):
soup = BeautifulSoup(info,'lxml')all_image = soup.find_all(’img’,class_='BDE_Image') #一个一个保存x=1for image in all_image: print(image) urllib.request.urlretrieve(image[’src’],'C:Usersjack Lees%.jpg' %(x)) x+=1
url = 'https://tieba.baidu.com/p/2218566379'info = get_content(url)print (info)get_image(info)
问题解答
回答1:是%s ,而不是 s%
相关文章:
1. mysql根据输入的字段数据获取到ID怎么解决??2. composer安装一直提示需要gmp扩展3. php工具中的mysql还是5.1以下的,请问如何才能升级到5.1以上?4. mysql - 数据库字段命名问题,新人,求解5. phpstudy 发现多个后门木马,有人遇到过吗?6. php代码运行报错7. 我 想好好学精通一门技术,大家用的走过的路,帮我指点指点呗 让我少走了弯路和坑的苦 ,自学,自己摸8. javascript - onclick事件点击不起作用9. mysql 使用group_concat后 顺序改变是怎么回事?10. javascript - 有没有什么办法过滤掉数据库中的乱码?
排行榜

网公网安备