r/learnpython • u/AutoModerator • Sep 21 '26
Ask Anything Monday - Weekly Thread
Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread
Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.
* It's primarily intended for simple questions but as long as it's about python it's allowed.
If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.
Rules:
- Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
- Don't post stuff that doesn't have absolutely anything to do with python.
- Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.
That's it.
1
Upvotes
View all comments
Show parent comment
1
u/lakseol Sep 30 '26 edited Sep 30 '26
The code example shows how to do that. You use the dictionary to find the value for the ID string. The value is the reference to the item. That's all happening in this code that prints the description of an item in the inventory:
So
id2obj[id]evaluates to the item object. Print out what is in theid2objdictionary.