I have two dictionaries,
var1 = {'name': 'alice'}
var2 = {'name': 'bob'}
I would like to concatenate these to produce,
var3 = {'name': 'alice'},{'name': 'bob'}
How is this achieved?
I have two dictionaries,
var1 = {'name': 'alice'}
var2 = {'name': 'bob'}
I would like to concatenate these to produce,
var3 = {'name': 'alice'},{'name': 'bob'}
How is this achieved?
To add the key-value pairs of dict2
to the ones of dict1
you can use dict1.update(dict2)
. This modifies dict1
obviously though.
Thanks to NightShadeQueen for the correct solution:
To obtain var3
, doing var3 = var1,var2
is the way to achieve this