[root@qiansw tmp]# cat test.py #这是一个python示例程序
1
2
3
|
#!/usr/bin/python
for
i
in
range
(
0
,
5
):
print
i
|
[root@qiansw tmp]# ll
total 48
-rw-r--r-- 1 root root 48 Oct 30 11:04 test.py
[root@qiansw tmp]# chmod +x test.py #为脚本增加执行权限
[root@qiansw tmp]# ./test.py #这是第一种方法
0
1
2
3
4
[root@qiansw tmp]# python test.py #这是第二种方法,不用增加执行权限
0
1
2
3
4