0
File Handling
x=open ('file.txt', 'w') x.write('hello') x.close() when I run the above code it is throwing an error saying write is not defined.....I'm using python 3.6....please help me
3 Answers
+ 3
It works for me. Try this.
x=open ('file.txt', 'w')
x.write('hello')
x.close()
y = open('file.txt')
print(y.read())
y.close()
# Output is hello
0
I have the same problem try using anaconda distribution. In anaconda distribution all these work
0
Thanks @Chaitanya