Linux写python脚本
时间: 2023-11-07 16:23:59 浏览: 104
1. 创建一个新文件,文件名以.py结尾,比如hello.py。
2. 在文件的第一行加入shebang(#!)语句,指定Python解释器的路径,例如:#!/usr/bin/env python。
3. 编写Python代码,以实现所需的功能。
4. 保存文件并关闭。
5. 在终端中执行chmod +x hello.py,使文件可执行。
6. 在终端中运行python hello.py或./hello.py,执行脚本。
阅读全文
相关推荐













