Skip to content Skip to sidebar Skip to footer

Making A Variable Accessible For Any Other Module

I am a new user in Python, I have been following this web page and it has helped me a lot. At this moment I am trying to solve an issue of a variables that can´t be accessed from

Solution 1:

When you do import entrada you import the module, not the names inside it. You can either do:

import entrada
size = len(entrada.cadena)

or

from entrada import cadena
size = len(cadena)

You should read the Python tutorial to learn the basics of module importing in Python.


Post a Comment for "Making A Variable Accessible For Any Other Module"