国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python 捕獲 shell/bash 腳本的輸出結果實例

2019-11-25 16:25:39
字體:
來源:轉載
供稿:網友

#!/usr/bin/python
## get subprocess module
import subprocess
 
## call date command ##
p = subprocess.Popen("date", stdout=subprocess.PIPE, shell=True)
 
## Talk with date command i.e. read data from stdout and stderr. Store this info in tuple
## Interact with process: Send data to stdin. Read data from stdout and stderr,
## until end-of-file is reached.Wait for process to terminate. The optional input
## argument should be a string to be sent to the child process, or None,
## if no data should be sent to the child. ##
(output, err) = p.communicate()
 
## Wait for date to terminate. Get return returncode ##
p_status = p.wait()
print "Command output : ", output
print "Command exit status/return code : ", p_status
 
## from: http://www.cyberciti.biz/faq/python-run-external-command-and-get-output/

以上就是小編為大家帶來的python 捕獲 shell/bash 腳本的輸出結果實例全部內容了,希望大家多多支持武林網~

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 德州市| 五常市| 子洲县| 长岭县| 襄樊市| 通化市| 临桂县| 彰武县| 丹巴县| 元朗区| 辽中县| 信宜市| 当阳市| 广宁县| 建湖县| 锡林浩特市| 饶阳县| 丰镇市| 常德市| 湖州市| 巴彦淖尔市| 洛扎县| 平湖市| 茶陵县| 教育| 富源县| 清水县| 丰顺县| 新宁县| 江陵县| 峡江县| 肥城市| 渑池县| 和平县| 上饶市| 房产| 新绛县| 商丘市| 封开县| 定陶县| 台州市|