我正在尝试运行我在网上找到的刮板,但收到 ValueError: too many values to unpack on this line code
k, v = piece.split("=")
此行是此功能的一部分
def format_url(url):
# make sure URLs aren't relative, and strip unnecssary query args
u = urlparse(url)
scheme = u.scheme or "https"
host = u.netloc or "www.amazon.com"
path = u.path
if not u.query:
query = ""
else:
query = "?"
for piece in u.query.split("&"):
k, v = piece.split("=")
if k in settings.allowed_params:
query += "{k}={v}&".format(**locals())
query = query[:-1]
return "{scheme}://{host}{path}{query}".format(**locals())
如果您有任何意见,将不胜感激,谢谢。