Back
I have the 2 files in my folder:
text.txtmain.py
text.txt
main.py
I want to show a text written in text.txt in the terminal when the main.py is run. How can I do this?
Use the below code:
with open('text.txt', 'r') as f: print(f.read())
with open('text.txt', 'r') as f:
print(f.read())
Learn Python for Data Science Course to improve the technical knowledge.
31k questions
32.8k answers
501 comments
693 users