How to append a dictionary to list of dictionaries with Python

1 Answer

0 votes
lst = [
	{
		'python':87,
		'java':12
	},
	{
		'c':578,
		'c++':908
	},
	{
		'php':3,
		'c#':7
	}
]


lst.append({'go':555, 'f#':888})

print(lst)

      

  
  
'''
run:
  
[{'python': 87, 'java': 12}, {'c': 578, 'c++': 908}, {'php': 3, 'c#': 7}, {'go': 555, 'f#': 888}]

'''

 



answered Jan 13, 2021 by avibootz
...