Anyone can please explain the difference between .py and .pyc files?

Submitted 4 years, 2 months ago
Ticket #340
Views 402
Language/Framework Python
Priority Low
Status Closed

Any help would be appreciated

Submitted on Feb 04, 21
add a comment

2 Answers

Verified

Python compiles the .py files and saves it as .pyc files , so it can reference them in subsequent invocations. The .pyc contain the compiled bytecode of Python source files. The .pyc contain the compiled bytecode of Python source files, which is what the Python interpreter compiles the source to. This code is then executed by Python's virtual machine . There's no harm in deleting them (.pyc), but they will save compilation time if you're doing lots of processing.

Submitted 4 years, 2 months ago
sai


Verified

Python compiles the py files and saves it as .pyc files.

The .pyc files contain the compiled bytecode of python source files.The .pyc is not created for main program file that execute. The .pyc file is only for imported modules.

Submitted 4 years, 2 months ago


Latest Blogs