i have these two dictionaries and i would like to add the data dict1 in dict2. how can i do that with python ?
dict1 = {
213688169:
{'stationCode': '6003',
'station_id': 213688169,
'num_bikes_available': 10,
'numBikesAvailable': 10,
'num_bikes_available_types': [{'mechanical': 10}, {'ebike': 0}],
'num_docks_available': 10,
'numDocksAvailable': 10,
'is_installed': 1,
'is_returning': 1,
'is_renting': 1,
'last_reported': 1619207955}
}
dict2 = {
213688169:
{'station_id': 213688169,
'name': 'Benjamin Godard - Victor Hugo',
'lat': 48.865983,
'lon': 2.275725,
'capacity': 35,
'stationCode': '16107'}
}
i tried this but it's too long and complicated :
donnees=[]
for i in stations:
for j in velib_description :
if i['station_id'] == j['station_id']:
List={}
List['name'] = i['name']
List['lat'] = i['lat']
List['lon'] = i['lon']
List['capacity'] = i['capacity']
List['num_bikes_available'] = j['num_bikes_available']
List['num_bikes_available_types'] = j['num_bikes_available_types']
List['last_reported'] = j['last_reported']
donnees.append(List)
I want to add in dict_2 = {num_bikes_available', 'num_bikes_available_types', last_reported': 1619207955 }
thank you