File Handling | Sololearn: Learn to code for FREE!

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

7/17/2019 8:47:44 AM

Uthpala

3 Answers

New Answer

+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