0
点赞
收藏
分享

微信扫一扫

Windows-python 如何关闭cmd

alonwang 2022-08-31 阅读 118


在其他命令不好使的情况下。比如:

    #sys.exit(0)
    #os._exit(0)
    都没反应。  推荐用
    os.system("taskkill /f /im cmd.exe") 。可以完美解决!

 

另外python写入文件的命令:

 with open("result.txt","w") as f:
        f.write(str(“”写入的内容!“”)) 

举报

相关推荐

0 条评论