I have a python script with inputs that I used to modify a txt file.
from datetime import dateimport datetime#oggi = date.today()oggi = datetime.datetime.now()oggi1 = oggi.strftime("%d/%m/%Y")f = open("/storage/emulated/0/Python/stadio_2023_2024.txt", "a")avversaria = input("Avversaria: ")competizione = input("SA, CI, CU o Am: ")dove = input("C, T o N: ")f.write("\n" + oggi1 +" " + avversaria +" " + competizione +" " + dove)f = open("/storage/emulated/0/Python/stadio_2023_2024.txt", "r")testo = f.read()print(testo)f.close()
What I am trying to do, is to also append at the beginning of each new row a sequence number with the format 001.
I would like the output to be:
001 30/12/2023 Juventus SA T002 03/01/2024 Cremonese CI C...132 04/03/2031 Liverpool CU T
Any hints?