[Solved] I Want to access the variable of a if statement in the function .Python
[ad_1] Set your variable before the if : def Home(request):#django city = ” if request.method == ‘POST’: city = request.POST.get(‘search’) print(city) URL = f’http://api.openweathermap.org/data/2.5/weather?q={city} 0 [ad_2] solved I Want to access the variable of a if statement in the function .Python