Newbie - Python crawler problem help
phpcn_u1582
phpcn_u1582 2017-07-05 10:35:09
0
1
888

Problem description: ValueError: unsupported format character 'j' (0x6a) at index 21
That is, the 6th line from the bottom.jpg What's wrong with j? ? ?
import urllib.request
from bs4 import BeautifulSoup
def 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=1
for image in all_image:
    print(image)
    urllib.request.urlretrieve(image['src'],"C:\Users\jack Lee\s%.jpg" %(x))
    x+=1

url = "https://tieba.baidu.com/p/2218566379"
info = get_content(url)
print (info)
get_image(info)

phpcn_u1582
phpcn_u1582

reply all(1)
迷茫

is %s, not s%

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template