Python Module

0
11KB

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

Pesquisar
Categorias
Leia mais
Business
What Should I Write About on My Blog? (Finding Topics That Attract and Engage Readers)
One of the most common challenges bloggers face is deciding what to write about. Even after...
Por Dacey Rankins 2025-09-23 16:42:07 0 2KB
Life Issues
The Father. (2020)
A man refuses all assistance from his daughter as he ages. As he tries to make sense of his...
Por Leonard Pokrovski 2023-02-06 13:37:54 0 20KB
Business
Sales leads: types and methods of attraction
What does it mean? Sales leads are users who visited the website, visited the company's page on...
Por Dacey Rankins 2024-09-13 19:07:34 0 13KB
Programming
Python pow()
The pow() method is a math built-in method where it calculates the 2 numbers. The pow() method...
Por Jesse Thomas 2023-04-13 18:09:50 0 11KB
Stories
The History of Movies: A Journey Through Time and Technology
The history of movies is a fascinating story of creativity, technological innovation, and...
Por Dacey Rankins 2025-01-24 18:14:52 0 14KB

BigMoney.VIP Powered by Hosting Pokrov