Python Module

0
11K

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

Zoeken
Categorieën
Read More
Ужасы
Заклятие 3: По воле дьявола. The Conjuring: The Devil Made Me Do It. (2021)
18 июля 1981 года Эд и Лоррейн Уоррены присутствовали при проведении экзорцизма над маленьким...
By Nikolai Pokryshkin 2022-09-19 20:53:22 0 38K
Programming
asyncio.sleep() vs time.sleep()
Both of these functions basically has the same purpose, but a little different. Time.sleep()...
By Jesse Thomas 2023-03-15 19:00:59 0 12K
Жизненные вопросы
Токийская повесть. Tokyo Story. (1953)
Пожилая супружеская пара едет из провинции в Токио навестить детей: сына, ставшего доктором, и...
By Nikolai Pokryshkin 2023-04-13 10:36:07 0 27K
Mental Health
ADHD: Exercise
Regular physical exercise, particularly aerobic exercise, is an effective add-on treatment for...
By Kelsey Rodriguez 2023-05-03 17:41:29 0 10K
Business
How Do You Balance Short-Term Goals with Long-Term Vision?
One of the most challenging responsibilities for leaders, executives, and especially product...
By Dacey Rankins 2025-08-21 16:43:18 0 3K

BigMoney.VIP Powered by Hosting Pokrov