Ask coding questions

← Back to all posts
PlS Help
Hoboman5454 (1)

Hey Everyone
i would like to know if there was a way to insert a file like a notepad or just a general text document to a python file

Answered by ch1ck3n (2373) [earned 5 cycles]
View Answer
Comments
hotnewtop
Hoboman5454 (1)

@ch1ck3n my question was in a python file is there a way to link a text document or file (like if you save something in notepad) so like you can open website links but can you open files/documents

ch1ck3n (2373)

@Hoboman5454

well if you want to read what a file says

myfile = open('myfil.txt', 'r')
print(myfile.read())
xfinnbar (149)

Don't forget to use myfile.close() after you are done!!! @Hoboman5454