Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
python-io [2019/02/14 06:56]
telatina
python-io [2019/02/14 06:59] (current)
telatina
Line 17: Line 17:
 my_output_file.close() my_output_file.close()
 </​code>​ </​code>​
 +
 +<code python>
 +input_file = open('​file.txt',​ '​r'​)
 +
 +if input_file.mode == '​r':​
 +    contents = input_file.read()
 +    print(contents)
 +</​code>​
 +