Answers for "does python compile"

1

compile python to pyc

import py_compile
py_compile.compile('yourFile.py')
# the compiled file will be saved as yourfile.pyc in a __pycache__ folder, which will be created the same folder as yourfile.py
Posted by: Guest on June-18-2020
13

is python interpreted or compiled

--Is Python interpreted or compiled?--

First, some definitions:
	-An interpreted language reads your code line by line,
    and executes them as they are read
    -A compiled language converts *all* of your code into
    another form first. Note, the other form does not have
    to be machine code! This could be bytecode too.

Python is both compiled and interpreted. Python actually
converts your code into bytecode first (for example, .pyc),
then interprets your code. You might hear people call
Python "interpreted", but you would know that they are not
completely correct.
Posted by: Guest on September-29-2020

Python Answers by Framework

Browse Popular Code Answers by Language