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

Rechercher
Catégories
Lire la suite
Business
How Do I Protect My Intellectual Property?
Protecting your intellectual property (IP) is one of the most important steps in securing the...
Par Dacey Rankins 2025-03-03 14:53:24 0 11KB
Nature and Science
A Beautiful Mind. (2001)
After John Nash, a brilliant but asocial mathematician, accepts secret work in cryptography, his...
Par Leonard Pokrovski 2023-02-17 16:55:42 0 37KB
Marketing and Advertising
Press Release vs. Media Alert vs. Press Statement vs. Blog Post: What’s the Difference and When to Use Each
Introduction: The Confusion in Modern Media Communication Public relations professionals often...
Par Dacey Rankins 2025-10-28 17:13:34 0 3KB
Social Issues
Catch Me If You Can. (2002)
Barely 21 yet, Frank is a skilled forger who has passed as a doctor, lawyer and pilot. FBI agent...
Par Leonard Pokrovski 2023-03-16 18:24:27 0 24KB
Business
Product Development Stages: How to Create Your Product and Sell It Successfully
Product Development Stages: How to Create Your Product and Sell It Successfully  ...
Par Leonard Pokrovski 2024-07-27 11:18:40 0 21KB

BigMoney.VIP Powered by Hosting Pokrov