Pycharm+Python+PyQt5使用
http://www.cnblogs.com/dalanjing/p/6978373.html
import os, sys running = True menu = """ 赤峰市智慧教育云平台系统维护工具Version 1.0 -------------------------------------------- 1: 一键查看服务状态 2: 重启Nginx 3: 重启Mysql数据库 h: 重启Ssdb数据库 q: 退出 -------------------------------------------- """ menu_dict = { "1": "cd c:\", "2": "dir", "3": "dir/s", "4": "netstat -lnt", } def commands(args): cmd = menu_dict.get(args) return cmd if __name__ == "__main__": os.system('cls') print(menu) while running: print(menu) cmd = input("请选择:") if cmd != 'q': try: os.system('cls') print( menu) if cmd not in menu_dict.keys(): print("输入错误,请重新输入!") continue fo = os.popen(commands(cmd)) print(fo.read()) except Exception as e: print(e) else: print('系统退出.') os.system('cls') sys.exit()