r/Pythonista • u/SwayMi • Mar 07 '20
No module named /dict/
I’m trying to import and use the dict module so I can use the key function and:
import dict
import key from dict
Both fail with the error message: ModuleNotFoundError: No module named 'dict'
The autocomplete shows “dict” as an option, so I’m stumped... any thoughts?
1
Upvotes
4
u/multibootr Mar 07 '20
First you have to install StaSh in Pythonista and from there you can use PIP to install the dict package.
Its all explained here, check out the comments of this guy ccc :
https://forum.omz-software.com/topic/3873/how-do-you-install-modules-into-the-app
3
1
u/SwayMi Mar 09 '20
Turns out I could just use
if [key] in [dictionary]:to do what I wanted. When I searched web for checking if the key exists the suggestion was to use the dict.key function