August 2018
Intermediate to advanced
466 pages
10h 23m
English
Any Python source file can be used as a module, and any functions and classes you define in that source file can be reused. To load the code, the file referencing the module needs to use the import keyword. Three things happen when the file is imported:
Remember the subtract() function that you defined using the interactive shell? To reuse the function, we can put it into a file named subtract.py:
def subtract(a, b): c = a - b return c
In a file within the ...
Read now
Unlock full access