Last active
August 13, 2017 12:08
-
-
Save Sulkar/862cba9dc71bdf03da05a0858a06062a to your computer and use it in GitHub Desktop.
[python] testing "import xxx" and "from xxx import xxx"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import random module | |
import random | |
tempRandom = random.randint(0, 9) | |
print(tempRandom) | |
# lists all functions of the random module | |
print(dir(random)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import only randint function of random module | |
from random import randint | |
tempRandom = randint(0, 9) | |
print(tempRandom) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
explanation why
from x import *
not importing everything:https://stackoverflow.com/questions/19883870/python-from-x-import-not-importing-everything