I have a list of dictionaries:
list = [{"id":2, "date": "2018-07-12"}]
Now I want to generate some nice output and have a function for it:
def generateOutput(myList):
outputList = []
for l in myList:
l['date_short'] = "Jul-12"
outputList.append(l)
return outputList
And here's where the desaster starts:
output = generateOutput(list)
output is fine but list that I need for further calculation and shouldn't have the date_short at all got a new key and is:
list = [ {"id":2, "date": "2018-07-12", "date_short": "Jul-12" }]
How to overcome this?