Ok so I am trying to save all the keys that as the same value on the same line.
lista = {'Cop': '911', 'Police chief': '911'}
spara = lista
fil = open("test" + ".txt","w")
print "savin to file "
for keys, values in spara.items():
spara_content = spara[keys] + ";" + keys
fil.write(spara_content)
fil.write(";")
fil.write("\n")
fil.close()
print lista
The code saves like this right now
911;Cop;
911;Police chief;
But i need the code to be like this when a key has the same value.
911;Cop;Police chief;