.py file

A plain text file whose name ends in .py, holding Python source code that the interpreter can run or import.

In more detail

Running python3 name.py executes the file as a program; import name loads it as a module. Idle, editors and the py launcher all recognise the ending. The file name, without .py, becomes the module name, so it should follow the rules for identifiers.

Example

python3 hello.py

Related terms

Taught in

References

Certification courses