This is part of an assignment. I want to read the input file with ulaz variable and write every 3rd character from that file to the output file. I was thinking about writing the first file to a list and than removing the '\n' firstly. After that, when writing to a new file, I can only think of using [::3] to take every 3rd character. At the moment, I am still struggling with input data. Whenever I write to a lista (list), I get all of the lines but not the first one. I am not sure why this is happening?
ulaz = input("Unesite ime fajla:")
# izlaz = input("Unesite ime fajla:")
with open(ulaz) as existing_file:
lista = []
for line in existing_file:
lista.append([s.rstrip('n') for s in existing_file])
print(lista)