gem-graph-client/scripts/let_us_read_this_file.py

21 lines
455 B
Python
Executable File

#!/usr/bin/env python3
filename = 'read_me.doc'
f = open(filename, 'r', encoding='UTF-8')
print("Contenu de " + filename)
print('-' * 30)
for line in f:
print(line, end='')
f.close()
# 'with' est une solution plus simple, qui gère automatiquement la fermeture du fichier.
filename = 'read_me.doc'
print("\n\nContenu de " + filename)
print('-' * 30)
with open(filename, 'r', encoding='UTF-8') as f:
for line in f:
print(line, end='')