Python Module

0
11KB

If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off using a text editor to prepare the input for the interpreter and running it with that file as input instead. This is known as creating a script. As your program gets longer, you may want to split it into several files for easier maintenance. You may also want to use a handy function that you’ve written in several programs without copying its definition into each program.

To support this, Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter. Such a file is called a module; definitions from a module can be imported into other modules or into the main module (the collection of variables that you have access to in a script executed at the top level and in calculator mode).

Rechercher
Catégories
Lire la suite
Environment
Climate Change Mitigation
Climate change is one of the most serious challenges facing humanity. To a large extent, it is...
Par FWhoop Xelqua 2022-09-05 09:17:41 0 40KB
Business
What Are Some Common Challenges Startup Founders Face?
Starting a business is an exciting and rewarding endeavor, but it also comes with its own set of...
Par Dacey Rankins 2025-04-01 16:29:27 0 7KB
Business
How Do Startup Founders Pay Themselves?
As a startup founder, one of the most crucial aspects of building a business is determining how...
Par Dacey Rankins 2025-04-02 16:35:40 0 9KB
Financial Services
Why the private sector under invests in innovation
Key points New technology often has positive externalities—in other words,...
Par Mark Lorenzo 2023-05-11 20:18:37 0 11KB
Business
What Challenges Did the CEO Face in Their Career?
Every CEO, no matter how successful, has faced significant challenges on the road to the top....
Par Dacey Rankins 2025-06-30 14:05:33 0 6KB

BigMoney.VIP Powered by Hosting Pokrov