StudyRepo_Synergy/part2_OOP/lesson5/file_read.py

11 lines
275 B
Python

counter = 0
print('file: sample.txt')
print('#' * 60)
with open('sample.txt', mode='r') as f:
for line in f.readlines():
counter += 1
print(line.strip())
print('#' * 60)
print('end file')
print('Количество строк в sample.txt is', counter)