What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-08 21:38:08
combine two dictionary adding values for common keys
a = { "a": 1, "b": 2, "c": 3 } b = { "a": 2, "b": 3, "d": 5 } # Python 3.5 for key in b: if key in a: b[key] = b[key] + a[key] c = {**a, **b} print(c) >... Add solution -
Python 2021-10-22 04:03:04
python concatenate dictionaries
z = {**x, **y} #python 3.5 and above z = x | y #python 3.9+ ONLY def merge_two_dicts(x, y): # python 3.4 or lower z = x.copy() # start with x's keys and values z.update(y) # modifies z with y's keys and values & returns None ... Add solution -
Python 2021-09-12 13:08:02
ModuleNotFoundError: No module named 'rospkg'
# `python-catkin-tools` is needed for catkin tool # `python3-dev` and `python3-catkin-pkg-modules` is needed to build cv_bridge # `python3-numpy` and `python3-yaml` is cv_bridge dependencies # `ros-melodic-cv-bridge` is needed to install a lot of cv_bridg... Add solution -
SQL 2021-09-10 11:55:03
how to take backup of mysql database using python
#!/usr/bin/python ########################################################### # # This python script is used for mysql database backup # using mysqldump and tar utility. # # Written by : Rahul Kumar # Website: http://tecadmin.net # Created date: De... Add solution -
Python 2021-09-07 14:51:01
request.body django
In Python 3.0 to Python 3.5.x, json.loads() will only accept a unicode string, so you must decode request.body (which is a byte string) before passing it to json.loads(). body_unicode = request.body.decode('utf-8') body = json.loads(body_unicode) content... Add solution