文章详情页
新手 - Python 爬虫 问题 求助
浏览:199日期: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. node.js - nodeJS 写入文件的内容怎么不是按次序的?2. 用CSS3 box-sizing 属性实现两个并排的容器,如果想让容器中间有间隔该如何实现3. javascript - 求一款靠谱点的移动端图片查看器插件,老司机速进!4. debian - docker依赖的aufs-tools源码哪里可以找到啊?5. docker gitlab 如何git clone?6. oop - Java中,关于匿名内部类调用外部类方法的疑惑7. javascript - angular左右滑动如何切换路由状态,????8. javascript - jquery hide()方法无效9. 这是什么情况???10. 网页爬虫 - Python爬虫入门知识
排行榜

网公网安备