Issue
I have a dictionary called sortdi with keys as integers and values as strings. I want to store the values into a dataset so I created the following code
sortdi = sortFreqDict(dictonary)
dataset = sortdi.values()
When I try to run the code, the error that shows up is ,
AttributeError: 'list' object has no attribute 'values'
What do I do to store values into the dataset ?
Solution
It looks like the sortFreqDict
function returns a list
not a dictionary
. To add to a list
you use list.append()
.
Try printing sortdi
and see if that gives you what you were hoping for?
Answered By - ShrutiTurner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.