I am facing problem when I try to write information to the file using .format()
.
I am trying to write()
text that has been read from text file to another file and then write information about every line:
{0}
- the number of lines{1}
- how many space symbols the line has{2}
- how many total symbols the line has
def Spausdinti_Faile(duom, tarpai_kiek, simboliai_kiek):
with open("rez.txt", "w") as fout:
i = 0
for i in range(len(duom)):
fout.write(duom[i])
print(tarpai_kiek, simboliai_kiek)
i = 0
for i in range(len(duom)):
fout.write("{0} eilutė turi {1} tarpų simbolių ir {2}
simbolių.".format(str(i + 1), str(tarpai_kiek[i]),
str(simboliai_kiek[i])))
I get this error: