Python Module

0
12K

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
Social Issues
Bowling for Columbine (2002)
Filmmaker Michael Moore explores the roots of America's predilection for gun violence. My Link
By Leonard Pokrovski 2023-07-20 18:35:09 0 28K
Business
Can Indie Hacking Lead to a Sustainable Full-Time Income?
Indie hacking, the practice of building and growing small, independent businesses without the...
By Dacey Rankins 2025-02-17 16:41:42 0 22K
Sport
Senna (2010)
A documentary on Brazilian Formula One racing driver Ayrton Senna, who won the F1 world...
By Leonard Pokrovski 2023-07-04 19:54:58 0 29K
Business
Why Are Salaries So High in Silicon Valley?
Silicon Valley, home to tech giants like Google, Apple, and Meta, is known not only for...
By Dacey Rankins 2025-04-28 16:05:27 0 9K
Programming
Chrome Extensions Using Python
The idea is to compile Python to Javascript (technically a JS pre-compiler)...
By Jesse Thomas 2023-03-20 20:46:37 0 12K

BigMoney.VIP Powered by Hosting Pokrov