with open('text.txt','w') as text: text.write('hello')
f=open(r"c:\a.txt",'w')f.write("hello")f.close()