I created a dict
like so: dic = {80:90, 7:60, 9:1}
then I converted the dict into a list li = [dic.keys()]
but when I print I get [dict_keys(['80, 7, 9'])]
.
How do I remove everything but '80, 7, 9'
?
I created a dict
like so: dic = {80:90, 7:60, 9:1}
then I converted the dict into a list li = [dic.keys()]
but when I print I get [dict_keys(['80, 7, 9'])]
.
How do I remove everything but '80, 7, 9'
?
Try this
li = dic.keys()
keys() already returns a list of the keys in your dictionary.