What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-05 13:49:12
AttributeError: 'NoneType' object has no attribute
As you are in python3 , use dict.items() instead of dict.iteritems() iteritems() was removed in python3, so you can't use this method anymore. Take a look at Python 3.0 Wiki Built-in Changes section, where it is stated: Removed dict.iteritems(), dict.i... Add solution -
Python 2021-10-30 00:54:10
how to get the key for a value in a dictionary in python
# function to return key for any value def get_key(val): for key, value in my_dict.items(): if val == value: return key return "key doesn't exist" # Driver Code my_dict ={"java":100, "... Add solution -
Python 2021-10-19 11:43:09
how to make list of keys which has same values
# Python code to demonstrate # finding duplicate values from dictionary # initialising dictionary ini_dict = {'a':1, 'b':2, 'c':3, 'd':2} # printing initial_dictionary print("initial_dictionary", str(ini_dict)) # finding duplicate value... Add solution -
Python 2021-10-12 19:37:06
loop throughthe key and the values of a dict in python
a_dict = {"color": "blue", "fruit": "apple", "pet": "dog"} # Will loop through the dict's elements (key, value) WITHOUT ORDER for key, value in a_dict.items(): print(key, '->', value) Add solution -
Python 2021-10-08 22:17:15
transformer un dictionnaire en liste python
# A list of the keys of dictionary list_keys = [ k for k in dict ] # or a list of the values list_values = [ v for v in dict.values() ] # or just a list of the list of key value pairs list_key_value = [ [k,v] for k, v in dict.items() ] Add solution