file handling | Sololearn: Learn to code for FREE!

0

file handling

msg = "Hello world!" file = open("newfile.txt", "w+") amount_written = file.write(msg) print(file.read()) print(amount_written) file.close() Why can i not read and write simultaneously..how to do it...

7/10/2018 8:24:27 AM

Anand Agrawal

4 Answers

New Answer

+1

yes you can both read and write file using file=open("newfile.txt","r+")

+1

it's same as asking why can't we use printf('string') instead of print('string') well,its just a notation

0

ok bro thanks but please check it's not happening in my code..even I do r+

0

check my code and answer I am not able to read the file