我有一些Python代码从crwaling输出中提取字符串。
目前我的代码:import requests, json, bs4, csv, re
import urllib
response = urllib.request.urlopen('https://currency-api.appspot.com/api/USD/EUR.json')
jsondata = json.loads(response.read().decode("utf-8"))
Wechselkurs = (jsondata['rate'])
jsonUrl = "https://www.jsox.de/s/results.json?&q=London& customerSearch=1&page=0
response = session.get(jsonUrl, headers=headers)
js_dict = (json.loads(response.content.decode('utf-8')))
for item in js_dict:
prices = js_dict['searchResults']["tours"]
for price in zip(prices):
price_final = price.get("price")["original"]
if price_final:
price_end = int(float(price_final)*100*Wechselkurs)
print(price_end)
这将产生一个错误:
^{pr2}$
为什么不能将“27,44\xa0€”转换为浮动?我想是因为我\xa
€
在我的float中防止解析。在
你们能帮帮我吗?欢迎任何反馈