How to modules? In python
So I have been learning python and what interests me the most are modules. But the problem is I don't know how to use them?
Modules are basically allowing code from other files being used in another file. For example:
import time imports the
time module, allowing all of the functions in
time to be used. To use a function from a module when you import a module as
import modulename, use
Modules are files which contain special functions that Python does not compile. When importing a module, you enable the editor to compile the functions in the module.
I am going to import the module random
But this only imports common functions. To import them all, you do this:
The * means everything.
Now when importing a module, you import lots of functions which takes more storage data. If you want to use a specific one, you can only import that. For example I want to import a function (randint, which chooses a random number), I do this:
You can use it to do fun stuff