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
История
Пожары. Incendies. (2010)
Когда брат и сестра Марван ознакомились с завещанием матери, их удивлению не было предела. Её...
Par Nikolai Pokryshkin 2023-01-23 12:00:36 0 33KB
Жизненные вопросы
Человек-слон. The Elephant Man. (1980)
Доктор Тривз находит Меррика в «фрик-шоу». Внешность его настолько ужасающая, что ему...
Par Nikolai Pokryshkin 2023-02-28 13:48:21 0 22KB
Business
How long does it take to start earning passive income?
The idea of earning passive income is appealing to many people, as it promises the opportunity to...
Par Dacey Rankins 2025-01-16 15:38:59 0 17KB
Business
How Do I Retain Startup Culture While Growing?
One of the most common fears entrepreneurs have when scaling is losing the unique startup culture...
Par Dacey Rankins 2025-09-05 15:44:45 0 7KB
Marketing and Advertising
What Are the Most Inspiring Advertising Biographies?
Advertising is an industry defined by pressure, rejection, creativity, and constant change....
Par Dacey Rankins 2026-01-08 12:11:33 0 2KB

BigMoney.VIP Powered by Hosting Pokrov