最近使用python paramiko寫一個多線程的框架,實現多線程執行命令,上傳文件,下載文件python
[root@zh rh]# cat paramiko.py # coding=utf8 runing = True while runing: print "1 執行cmd命令" print "2 上傳文件" print "3 下載文件" print "* quit" ten = int(raw_input('Enter a number:')) if type(ten) is not int: break else: if ten == 1: while runing: print "1 手動輸入命令" print "*(任意輸入) 返回上級目錄" cmd_number = int(raw_input('Enter a number(命令):')) if cmd_number == 1: cmd_run = raw_input('enter CMD:') print "%s"%cmd_run else: break elif ten == 2: while runing: print "1 上傳文件" print "*(任意輸入) 返回上級目錄" file_put = int(raw_input('Enter a number(上傳文件):')) if file_put == 1: file_run_put = raw_input('enter 源路徑 目標路徑:') print "%s"%file_run_put else: break elif ten == 3: while runing: print "1 下載文件" print "*(任意輸入) 返回上級目錄" file_get = int(raw_input('Enter a number(下載文件):')) if file_get == 1: file_run_get = raw_input('enter 服務器路徑 本地路徑:') print "%s"%file_run_get else: break else: break