新手 - Python 爬蟲(chóng) 問(wèn)題 求助
問(wèn)題描述
問(wèn)題描述: ValueError:unsupported format character ’j’ (0x6a) at index 21即倒數(shù)第6行 .jpg j出什么問(wèn)題了???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') #一個(gè)一個(gè)保存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)
問(wèn)題解答
回答1:是%s ,而不是 s%
相關(guān)文章:
1. javascript - 我的站點(diǎn)貌似被別人克隆了, google 搜索特定文章,除了域名不一樣,其他的都一樣,如何解決?2. macos - mac下docker如何設(shè)置代理3. javascript - webapp業(yè)務(wù)流程基本一致,多套主題(樣式基本不一樣,交互稍有偏差)管理,并且有不斷有新增主題,該如何設(shè)計(jì)組件化架構(gòu)?4. 請(qǐng)教各位大佬,瀏覽器點(diǎn) 提交實(shí)例為什么沒(méi)有反應(yīng)5. mysql - AttributeError: ’module’ object has no attribute ’MatchType’6. javascript - 從mysql獲取json數(shù)據(jù),前端怎么處理轉(zhuǎn)換解析json類(lèi)型7. dockerfile - 為什么docker容器啟動(dòng)不了?8. javascript - JS設(shè)置Video視頻對(duì)象的currentTime時(shí)出現(xiàn)了問(wèn)題,IE,Edge,火狐,都可以設(shè)置,反而chrom卻...9. javascript - web網(wǎng)頁(yè)版app返回上一頁(yè)按鈕在ios設(shè)備失效怎么辦?安卓上可以,代碼如下,請(qǐng)大神幫助,萬(wàn)分感謝。10. javascript - 學(xué)習(xí)網(wǎng)頁(yè)開(kāi)發(fā),關(guān)于head區(qū)域一段腳本的疑惑
