beginner trying to ask about python
Hello im new to python and in this online ide. Can i ask how to code the "how to read a text file in python" in this online ide??
Reading text files is simple
First, create a text file.
Click on the add file button.
Type a file name, then
.txt and hit
Inside the file, add whatever you want
Then go back to your
main.py and put this code
#Create a file object (replace <your-file-name> with your file name) f=open("<your-file-name>.txt") #Read it data=f.read() #Output the contents print(data) #Close the file f.close()
That should output whatever you put inside your text file