我是python的新手,目前正在编写一个从Web上删除数据的应用程序.它主要完成,编码只剩下一点问题.该网站编码ISO-8859-1,但当我尝试html.decode('iso-8859-1'),它没有做任何事情.如果你运行程序,使用50000和50126PLZs你会看到我在输出中的意思.如果有人可以帮助我,那将是非常棒的.
import urllib.request
import time
import csv
import operator
from bs4 import BeautifulSoup
#Performs a HTTP-'POST' request, passes it to BeautifulSoup and returns the result
def doRequest(request):
requestResult = urllib.request.urlopen(request)
soup = BeautifulSoup(requestResult)
return soup
#Returns all the result links from the given search parameters
def getLinksFromSearch(plz_von, plz_bis):
database = []
links = []
#The search parameters
params = {
'name_ff': '',
'strasse_ff': '',
'plz_ff': plz_von,
'plz_ff2': plz_bis,
'ort_ff': '',
'bundesland_ff': '', …Run Code Online (Sandbox Code Playgroud)