Python read a file

82 Views
Published
Python reading files tutorial example explained

#python #read #file

try:
with open('test.txt') as file:
print(file.read())
except FileNotFoundError:
print("That file was not found :(")

––––––––––––––––––––––––––––––
Up In My Jam (All Of A Sudden) by - Kubbi https://soundcloud.com/kubbi
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
Free Download / Stream: http://bit.ly/2JnDfCE
Music promoted by Audio Library https://youtu.be/tDexBj46oNI
––––––––––––––––––––––––––––––
Category
Bro Code
Tags
Python, Python Files, File io
Be the first to comment