Python Module

0
9KB

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
Научная фантастика и фэнтези
Метрополис. Metropolis. (1927)
Метрополис - город будущего, разделен на две части. Под землей находятся жилища рабочих, над ними...
Par Nikolai Pokryshkin 2023-01-28 17:51:11 1 20KB
Social Issues
Taxi Driver. (1976)
A mentally unstable veteran works as a nighttime taxi driver in New York City, where the...
Par Leonard Pokrovski 2023-01-28 17:27:40 0 17KB
Mental Health
Dyslexia: Genetics
Research into potential genetic causes of dyslexia has its roots in post-autopsy examination of...
Par Kelsey Rodriguez 2023-06-21 16:25:46 0 9KB
Computers
Children and the computer: harm and benefit
A computer for the little ones Preschoolers, of course, do not need their own computer. For...
Par FWhoop Xelqua 2023-01-28 16:59:00 0 22KB
Социальные проблемы
Секреты Лос-Анджелеса. L.A. Confidential. (1997)
Бад Уайт и Эд Эксли работают в полиции Лос-Анджелеса. Они настолько разные, что порой ненавидят...
Par Nikolai Pokryshkin 2023-01-29 11:40:28 0 18KB

BigMoney.VIP Powered by Hosting Pokrov