[Python] Execute a Python Script

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Python] Execute a Python Script相关的知识,希望对你有一定的参考价值。

Python scripts can be executed by passing the script name to the python command or created as executable commands that can run stand-alone. You’ll learn how to create both in this lesson.

 

script.py:

print("Hello World")

 

When we want to run the script, we can do:

python3 script.py

 

We can also make the script a stand-alone executable:

#! /usr/bin/env python

print("Hello World")
chmod +x script.py
./script.py

 

以上是关于[Python] Execute a Python Script的主要内容,如果未能解决你的问题,请参考以下文章

python之selenium调用js(execute_script)

/usr/lib/python2.7/subprocess.py", line 1239, in _execute_child

Python 通

我们如何获得python int占用的字节数?

Python 增删改查

python操作pymysql