Python Module

0
12Кб

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).

Поиск
Категории
Больше
Business
What Legacy Did They Leave Behind?
A leader’s true impact is often measured not during their lifetime, but in the legacy they...
От Dacey Rankins 2025-06-27 16:41:31 0 4Кб
Business
Do You Have Any Questions for Us? A Key Moment to Show Interest and Engagement
At the end of most job interviews, candidates are asked, “Do you have any questions for...
От Dacey Rankins 2025-06-25 12:47:40 0 7Кб
Мероприятия
Understanding the Significance of Events: Exploring Moments that Shape Our Lives
Understanding the Significance of Events: Exploring Moments that Shape Our Lives Events are the...
От Leonard Pokrovski 2024-05-25 11:14:06 0 28Кб
Programming
Python Regex
A RegEx, or Regular Expression, is a sequence of characters that forms a search...
От Jesse Thomas 2023-04-05 19:02:13 0 12Кб
Mental Health
ADHD: Psychiatric Comorbidities
In children, ADHD occurs with other disorders about two-thirds of the time. Other...
От Kelsey Rodriguez 2023-03-27 17:51:05 0 11Кб

BigMoney.VIP Powered by Hosting Pokrov