I would like to print a specific Python dictionary key:
mydic = {}
mydic[\'key_name\'] = \'value_name\'
Now I can check if mydic.has_
Probably the quickest way to retrieve only the key name:
mydic = {}
mydic['key_name'] = 'value_name'
print mydic.items()[0][0]
Result:
key_name
Converts the dictionary
into a list
then it lists the first element which is the whole dict
then it lists the first value of that element which is: key_name