Re: [問題] python 執行 shell script
※ 引述《gn00618777 (非常念舊)》之銘言:
: 板友們好
: 我在一個 web script 寫一個執行 shell 指令
: cmd=subprocess.Popen(['./create_tunnel.sh','%s'%tunnel_name],stdout=subprocess.PIPE, stderr=subprocess.PIPE)
: 它是可以把 tunnel_name 變數當作 create_tunnel.sh 的參數丟進去
: 但我要怎麼丟兩個參數阿? 試過
: cmd=subprocess.Popen(['./create_tunnel.sh','%s %s'%tunnel_name %tunnel_name1]
: 沒有成功
: 謝謝。
hi 我知道原因了
要改成
cmd=subprocess.Popen(['./create_tunnel.sh','%s %s'%(tunnel_name,tunnel_name2)]
就可以嚕
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.220.220.235
※ 文章網址: http://www.ptt.cc/bbs/Python/M.1420696557.A.E9E.html
→
01/08 14:32, , 1F
01/08 14:32, 1F
→
01/08 14:39, , 2F
01/08 14:39, 2F
→
01/08 14:39, , 3F
01/08 14:39, 3F
→
01/08 17:12, , 4F
01/08 17:12, 4F
→
01/08 17:12, , 5F
01/08 17:12, 5F
→
01/09 09:45, , 6F
01/09 09:45, 6F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):