Python Module

0
12KB

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
What Are the Best Tools for Startup Founders?
Starting a new business can be both exciting and overwhelming. As a startup founder, you'll wear...
Par Dacey Rankins 2025-04-04 14:15:30 0 13KB
Television
Fairfax Ch. 16. Live TV. Virginia, USA.
Stay informed! Watch Fairfax County public meetings live, and the latest events and activities on...
Par Nikolai Pokryshkin 2022-10-14 17:17:39 0 27KB
Business
How Do CEOs Align Short-Term Actions with Long-Term Company Vision?
One of the most critical challenges for any CEO is ensuring that the company’s immediate...
Par Dacey Rankins 2025-08-07 17:27:00 0 9KB
Business
How Do I Become Good at Sales?
Becoming good at sales is one of the most valuable skills you can develop — not just for a...
Par Dacey Rankins 2025-12-12 16:57:18 0 3KB
Programming
Python Reverse Method
reverse() can flip the list around. The reverse() method doesn't return any value. It...
Par Jesse Thomas 2023-03-03 01:09:45 0 11KB

BigMoney.VIP Powered by Hosting Pokrov