0

Why it's not working ?

# FILE HANDLING file = open("index.html", "a"); file.write("<!-- Hello, World! -->") file.close() print(file.read())

25th Aug 2021, 10:56 AM
Aditya Dhiman
Aditya Dhiman - avatar
2 Answers
+ 2
Add>>> file=open("index.html","r") between file .close() line and print() line. !! Don't forget to call read mode("r")
25th Aug 2021, 5:04 PM
Myo Thuzar
Myo Thuzar - avatar
+ 3
How can you read a file after closing it ? And the read method also depends on the mode in which file is opened .
25th Aug 2021, 11:00 AM
Abhay
Abhay - avatar