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

最新文章

  1. 1Z0-053 争议题目解析501
  2. 大文件下载控件(down2)-示例更新-Xproer.HttpDownloader
  3. 转载:Spring AOP (上)
  4. poj2407 Relatives 欧拉函数基本应用
  5. ext 参考资料
  6. Android启动时间测试方法
  7. js常用效果
  8. 根据select不同的选项实现相应input框添加项的显示
  9. jQuery中$(function(){})与(function($){})(jQuery)、$(document).ready(function(){})等的区别详细讲解 ----转载
  10. Eureka的工作原理以及它与ZooKeeper的区别
  11. 经典51道SQL查询练习题
  12. gentoo Cataclysm - Dark Days Ahead
  13. java学习笔记(九):Java 流(Stream)、文件(File)和IO
  14. 在Idea创建Spring Boot + MyBatis的web项目
  15. 使用perfect进行服务端开发
  16. Asp.net中汉字转换成为拼音
  17. 用到的设计模式总结--单例模式+工厂方法模式+Builder模式
  18. 微服务之springCloud和docker-provide(二)
  19. P2167 [SDOI2009]Bill的挑战
  20. linux /dev 常见特殊设备介绍与应用[loop,null,zero,full,random]

热门文章

  1. 2014 ACM/ICPC Asia Regional Shanghai Online
  2. iOS开发如何实现消息推送机制
  3. DB2 的create or update方法
  4. 关于JS中的constructor与prototype
  5. linux yum 命令 详解
  6. ubuntu修改ip、网关、dns等
  7. mysql修改数据库表权限
  8. HDU4945 2048(dp)
  9. Wamp Mysql错误消息 语言设置
  10. iOS多线程的初步研究(十)-- dispatch同步