Hello, everyone.
Is there a way in python to insert all items from one dictionary to another inside variable assignment?
dict1 = {"a": 1, "b": 2, "c": 3}
dict2 = {"d": 4, #INSERT THERE ALL FROM "dict1"#, "e": -1}
Maybe there's smth like {key: value for key, value in temp.items()}
or other "hack"?
I know that there's update() method and I've already applied it, but it looks a bit weird. Order of entries matters so to build dict in proper order I need to write next code :
dict1 = {"a": 1, "b": 2, "c": 3}
dict2 = {"d: 4"}
dict2.update(dict1)
dict2.update({"e": -1, "f": -2})
Hope there's a way to do it more "nice".