Python Module

0
8K

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

Search
Categories
Read More
Programming
Python Assert
The assert keyword is used when debugging code. The assert keyword lets you...
By Jesse Thomas 2023-03-21 21:48:28 0 8K
Financial Services
What factors change demand?
Key points Demand curves can shift. Changes in factors like average income and...
By Mark Lorenzo 2023-06-27 18:14:33 0 8K
Business
What Are Some Common Ethical Issues in Business?
In the fast-paced world of business, ethical dilemmas often arise, challenging companies to make...
By Dacey Rankins 2025-01-31 15:16:10 0 7K
Financial Services
How changes in the cost of living are measured
Key points The Consumer Price Index, or CPI is a measure of...
By Mark Lorenzo 2023-06-09 20:21:34 0 9K
Business
Project Management Fundamentals: What Should You Focus On?
Project Management Fundamentals: What Should You Focus On?   "Focus on...
By Leonard Pokrovski 2024-08-11 15:30:50 0 14K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov