I'm trying to store some data from a html form in a .txt file. But when I store data from my variable used to recieve data it give "None". But when I pass string directly it successfully store.
def write(request):
p_no = request.GET.get('p_no')
# temp = "% s" % p_no
# Str_value = '{}'.format(p_no)
temp = p_no.__str__()
with open('C:\\Users\\The Goat\\Desktop\\testp\\Files\\sample.txt', 'w+') as f:
testfile = File(f)
testfile.write(temp)+
testfile.close
f.close
return render(request,'index.html')