Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python3 add dictionary to dictionary

dict_1 = {"1":"a", "2":"b", "3":"c"}
dict_2 = {"4":"d", "5":"e", "6":"f"}

dict_1.update(dict_2) 
print(dict_1)
#Output = {"1":"a", "2":"b", "3":"c", "4":"d", "5":"e", "6":"f"}
Comment

how to add an element in dictionary

thisdict =	{
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
thisdict["color"] = "red"
print(thisdict)
Comment

PREVIOUS NEXT
Code Example
Python :: handle queries in listview django 
Python :: internal server error 500 python flask 
Python :: count the number of rows in a database table in Django 
Python :: create an array string using for in python 
Python :: how to read xlsx file in jupyter notebook 
Python :: fixed precision float python 
Python :: image no showing in django 
Python :: remove element from list python 
Python :: python datetime strftime 
Python :: python list slicing 
Python :: python: measure time code 
Python :: convert url to base64 image py 
Python :: write data to using pickle 
Python :: if found then stop the loop python 
Python :: set the context data in django listview 
Python :: python file size in bytes 
Python :: pandas export csv without index 
Python :: select 2 cols from dataframe python pandas 
Python :: axes color python 
Python :: how store list in django session 
Python :: django media root 
Python :: django objects.create() 
Python :: remove add button django admin 
Python :: python replace char in string 
Python :: python delete text in text file 
Python :: python iterate through files in directory 
Python :: find the most similar rows in two dataframes 
Python :: Taking a list of strings as input, our matching function returns the count of the number of strings whose first and last chars of the string are the same. Also, only consider strings with length of 2 or more. python 
Python :: how to make a venv python 
Python :: templateDoesNotExist Django 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =