Scripted programming
Copy the following code to the hello.py file:
print("Hello,Python!");
Execute the script with the following command:
$python./hello.py
hello,python
Use Python's own IDEL
Python comes with an IDE called IDLE.
Content expansion:
Pyc file in Python practice
Introduction to pyc files
. The pyc file contains bytecode compiled from the python source file.
The Python parser tries to load the .pyc file before loading the .py. If it is the latest, there is no need to compile the Python source file again.
. The deletion of the pyc file has no effect
. The pyc file is not large, because it can save the loading time of the python program, it will help to shorten the overall execution time
Method of generating pyc file
Run python -m helloworld.py directly
Use py_compile to generate pyc file python -c "import py_compile; py_compile.compile('helloworld.py')"
Compile all the py files in the directory
import compileall
compileall.compile_dir(r'/path')
So far, this article on how to practice python files is introduced is here. For more related python files how to practice content, please search for ZaLou.Cn's previous articles or continue to browse related articles below. Hope you will support ZaLou more in the future. Cn!
Recommended Posts