Python 为什么得到类型错误:接受1个位置参数,但给出2个位置参数?
我的django项目遇到了一个问题。详情如下: 获取结果:uuu init_uuuu接受1个位置参数,但给出了2个 我的代码: url.py views.pyPython 为什么得到类型错误:接受1个位置参数,但给出2个位置参数?,python,django,Python,Django,我的django项目遇到了一个问题。详情如下: 获取结果:uuu init_uuuu接受1个位置参数,但给出了2个 我的代码: url.py views.py 视图函数应返回not an。视图函数应返回not an url(r'^_get_weather', views._get_weather, name='_get_weather') def _get_weather(request): r = urllib.request.urlopen('http://api.openweat
视图函数应返回not an。视图函数应返回not an
url(r'^_get_weather', views._get_weather, name='_get_weather')
def _get_weather(request):
r = urllib.request.urlopen('http://api.openweathermap.org/data/2.5/weather?APPID=$API&q=Hongkong')
s = r.read().decode('utf-8')
j = json.loads(s)
temp='Current tempearture: {:.2f}'.format(j['main']['temp'] - 273.15)
return HttpRequest(temp)