I am trying to clean text file from '// type comentaries' that go from place they start to end of line in text. Using 3 lists:
row=[]
redakbezkom=[]
cleantext=[]
I need 'clean' text in form of list that consists of words used in text. Iterating through text results in good cleanup but append is saving multiple instances of lines in clean list.
for line in Ulaz:
niz = line
del row[:]
del redakbezkom[:]
row=niz.split()
for words in row:
if words=='//':
break
else:
redakbezkom.append(words)
print redakbezkom
cleantext.append(redakbezkom)
print cleantext
Therefore print of cleantext results in: [ [last line] , ... (times number of line in text) ] instead of: [ [first line], [second line],...,[last line] ]
Why is append overwriting all former lines in list?