Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • My objects are not saved as dicts, they are saved as the value of a key. So my key might be x, and the value is myObject. I know what attributes are present, I just can't print them. It won't create an error, it will just be blank. If I tried to print "Hello, " myDict[key].attribute and it just prints "Hello, ". Commented Feb 7, 2014 at 4:46
  • @Johnny_Rose what does type(my_dict[key].attribute) yield? Also if you look into dir(my_dict[key]) is the attribute you need there? Have you considered that the attribute might be returning an empty string? Commented Feb 7, 2014 at 4:48
  • type(my_dict[key].attribute) returns string. I have considered the empty string, but the attribute in question is "name", and I know for certain there is a string of characters in it. Commented Feb 7, 2014 at 4:53
  • 1
    @Johnny_Rose How do you know it is there? It obviously is not. Show the whole code you are using (trim out things not needed). Otherwise, this is non-reproducible. Commented Feb 7, 2014 at 4:56
  • 1
    @Johnny_Rose if you can provide an example of the object it would be a better idea, the whole dict thing is probably not the issue in that case. Commented Feb 7, 2014 at 4:59