Python Module

0
13KB

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
Business
How Do On-Demand Businesses Make Money?
There is a moment that still sticks with me. A founder proudly walked me through a product demo....
Par Dacey Rankins 2026-06-30 05:31:43 0 4KB
Business
How Much Does It Cost to Hire a Business Consultant?
Hiring a business consultant can be a smart investment for any company looking to improve its...
Par Dacey Rankins 2025-02-10 18:16:58 0 20KB
Economics
What is John Maynard Keynes theory?
What Is John Maynard Keynes’ Theory? A Crisis, a Break, and an Uncomfortable Idea The...
Par Leonard Pokrovski 2026-04-30 22:48:21 0 3KB
Economics
How does climate change affect international economics?
How Does Climate Change Affect International Economics? Climate change is no longer only an...
Par Leonard Pokrovski 2026-08-25 00:20:44 0 2KB
Economics
Can capitalism reduce income inequality?
Can Capitalism Reduce Income Inequality? Income inequality has become one of the defining...
Par Leonard Pokrovski 2026-07-07 00:51:21 0 9KB

BigMoney.VIP Powered by Hosting Pokrov