首页 > 编程语言 > 详细

[Python] Execute a Python Script

时间:2017-12-09 18:58:20      阅读:194      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/Answer1215/p/8012206.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!