Py学习  »  Python

如何通过Python打开命令提示符[duplicate]

user12836146 • 6 年前 • 2079 次点击  
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54086
文章 [ 3 ]  |  最新文章 6 年前
FishingCode
Reply   •   1 楼
FishingCode    6 年前

在unix系统上,可以使用shebang(!#)在你的蟒蛇3开始处排队 脚本:

 #!/usr/bin/env python3 

 chmod +x ./the/pathtofilename
ticua
Reply   •   2 楼
ticua    6 年前

文件.bat:

echo hello!

python程序或解释器

import os
os.system("start file.bat")

在这种情况下将运行一个命令file.bat

为了运行一个程序,向我发送你想启动的代码,我将用python向你发送如何启动的代码

ticua
Reply   •   3 楼
ticua    6 年前

使用操作系统模块

import os
os.system("start cmd")

对于运行特定命令,也可以使用os module

import os
os.system("yourcommandhere")

用你的命令替换你的命令