What is the difference between .py and .pyc files?
Last updated 3 years, 2 months ago | 1441 views 75 5

The .py files are the python source code of a program. While the .pyc files contain the bytecode of the python files. We get bytecode after compilation of .py file (source code).
The .pyc files are not created for all the files that you run. it is created when the code is imported from some other source. The interpreter converts the source .py files to .pyc files if .pyc files are not already present.
Having .pyc file saves the compilation time.