StudyRepo_Synergy/part2_OOP/lesson5/file_read.py

11 lines
275 B
Python
Raw Permalink Normal View History

2023-12-03 16:26:19 +03:00
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)