博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
subprocess实现管道
阅读量:4318 次
发布时间:2019-06-06

本文共 360 字,大约阅读时间需要 1 分钟。

1 # shell2 last | cut -d ' ' -f 1 | sort -u
1 #python 2 from subprocess import Popen,PIPE 3  4 p1 = Popen('last',shell=True,stdout=PIPE) 5  6 p2 = Popen('cut -d ' ' -f 1,shell=True,stdin=p1.stdout,stdout=PIPE) 7  8 p3 = Popen('sort -u',shell=True,stdin=p2.stdout,stdout=PIPE) 9 10 >>print p3.stdout.read()

 

转载于:https://www.cnblogs.com/metasequoia/p/3767224.html

你可能感兴趣的文章
C# MySql 连接
查看>>
sk_buff Structure
查看>>
oracle的级联更新、删除
查看>>
多浏览器开发需要注意的问题之一
查看>>
Maven配置
查看>>
HttpServletRequest /HttpServletResponse
查看>>
SAM4E单片机之旅——24、使用DSP库求向量数量积
查看>>
从远程库克隆库
查看>>
codeforces Unusual Product
查看>>
hdu4348 - To the moon 可持久化线段树 区间修改 离线处理
查看>>
springMVC中一个class中的多个方法
查看>>
cxx signal信号捕获
查看>>
《Android开发艺术探索》读书笔记——Cha3.2.3改变布局参数实现View的滑动
查看>>
python闭包与装饰器
查看>>
Acegi 源码解释
查看>>
Activity的几种启动跳转方式
查看>>
LCA最近公共祖先Tarjan(离线)
查看>>
牛客练习赛16 E求值
查看>>
matlab rank
查看>>
Asp.net系列--基础篇(三)
查看>>