У меня есть файл .txt, который я создал с несколькими строками.
когда я запускаю цикл for с накопителем счетчика, он пропускает строки.
Он пропускает верхнюю строку и начинается со второй, печатает четвертую, шестую и т. Д. ...
Что мне не хватает?
** for your reading pleasure**
def main():
# Open file line_numbers.txt
data_file = open('line_numbers.txt', 'r')
# initialize accumulatior
count = 1
# Read all lines in data_file
for line in data_file:
# Get the data from the file
line = data_file.readline()
# Display data retrieved
print(count, ": ", line)
# add to count sequence
count += 1