0
Import int
In file1 i have a = 10, in file2 i import file1, but when I use the 'a' variable, it turns out that it is of the String type instead of Integer. Can I import int at once, or will I need to use int()?
2 ответов
+ 6
If you have stored your number as an int in that module, like...
a = 10
... you can just access that normally in your importing code, as an int. No further actions necessary.
import thatModule
print(thatModule.a + 32)
# Output: 42
+ 1
Whoops, thanks)