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

首頁 > 編程 > Python > 正文

python 捕獲 shell/bash 腳本的輸出結(jié)果實例

2020-02-23 04:14:26
字體:
供稿:網(wǎng)友

#!/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/

以上就是小編為大家?guī)淼膒ython 捕獲 shell/bash 腳本的輸出結(jié)果實例全部內(nèi)容了,希望大家多多支持武林站長站~

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 元江| 陈巴尔虎旗| 藁城市| 海宁市| 页游| 太仆寺旗| 乌海市| 荆门市| 盈江县| 石家庄市| 甘谷县| 左云县| 海伦市| 启东市| 同江市| 鸡西市| 孝义市| 江川县| 荆门市| 前郭尔| 久治县| 遵义县| 文成县| 秭归县| 左云县| 铜陵市| 曲阜市| 吐鲁番市| 耒阳市| 喜德县| 石棉县| 赫章县| 电白县| 绥阳县| 饶平县| 岑溪市| 温州市| 山东| 晴隆县| 元谋县| 德惠市|