I'm programming some things in Python, specifically a parser function that calls another function that returns the lines of a file, then, for each line a split is made to separate them into two fields, these fields are stored in a dictionary, then that dictionary item goes to a list. The problem I have is the list is filled only with the dictionary of the last line of the file, saying that the lines are entering one by one and if their respective dictionary item is being generated. I leave the code of the function.
'def parserDownloads(FILE_PATH):
list_filenames=[]
file_url={}
lines=readIpFile(FILE_PATH)
count=0
aux={}
while count<len(lines):
fields=lines[count].split("\t")
file_url["filename"]=fields[0]
file_url["url"]=fields[1]
print lines[count]
print file_url
list_filenames.append(file_url)
count=count+1
print list_filenames
return list_filenames'
Greetings!