# shell
last | cut -d ' ' -f 1 | sort -u
 #python
from subprocess import Popen,PIPE p1 = Popen('last',shell=True,stdout=PIPE) p2 = Popen('cut -d ' ' -f 1,shell=True,stdin=p1.stdout,stdout=PIPE) p3 = Popen('sort -u',shell=True,stdin=p2.stdout,stdout=PIPE) >>print p3.stdout.read()

subprocess More articles on implementing pipelines

  1. Python 3 utilize subprocess Implementation pipeline ( pipe ) Interactive read / Write correspondence

    Here we use Windows Under the shell For example : from subprocess import * # Because it's an example , It's all imported For your convenience , Let's use a very simple piece of code to illustrate : We can see that we use Pop ...

  2. Python Subprocess Popen Analysis and solution of pipeline blocking problem

    http://ju.outofmemory.cn/entry/279026 scene :1> Keep playing mp3 file : 2> Use subscription publishing mode to keep tcp A long connection , Receiving information from the server Create a program hang die , however ...

  3. Python Chapter five ( Next ): System standard module (shutil、logging、shelve、configparser、subprocess、xml、yaml、 Custom module )

    Catalog : shutil logging modular shelve configparser subprocess xml Handle yaml Handle Custom module One , System standard module : 1.shutil: It's a high-level file operation ...

  4. python Of subprocess: Subroutine call ( Call to execute other commands ); Get the current path of subroutine script

    python The current process can call child processes , Subprocess can execute other commands , Such as shell,python,java,c... And calling subprocess methods has os modular See :http://blog.csdn.net/longshe ...

  5. python Learning notes ——multiprocessing Multiprocess components Pipe The Conduit

    Interprocess communication (IPC InterProcess Communication) It's the value that spreads or exchanges information between different processes . IPC Through a pipe ( Nameless pipe and famous / name pipes ). Message queue . Shared memory / Content . Semaphore . ...

  6. Python,subprocess modular ( Add )

    1.subprocess modular , Foreplay res = os.system('dir') Print to screen ,res by 0 Or not 0 os.popen('dir') Returns a memory object , Equivalent to a file stream a = os.popen ...

  7. python in TCP The sticking problem in the agreement

    TCP The sticking problem in the agreement 1. Sticking phenomenon be based on TCP Realize a simple remote cmd function # Server side import socket import subprocess sever = socket.socket() s ...

  8. python in TCP Solutions to the sticking problem

    TCP The sticking problem in the agreement 1. Sticking phenomenon be based on TCP Write a remote cmd function # Server side import socket import subprocess sever = socket.socket() seve ...

  9. Network programming ——socket Development

    Socket Socket method socket Instance class (8-10 minute ) socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None) ...

Random recommendation

  1. C++11 And for New use of loop

    C++ Use the following method to traverse a container : #include "stdafx.h" #include<iostream> #include<vector> int m ...

  2. To write BinIoDemo.java Of Java Applications , The function of the program is : complete 1.doc Copy of documents , After copying the name of the file for their own student name .doc.

    package zuoye; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; ...

  3. DNA repair problem

    problem :Biologists finally invent techniques of repairing DNA that contains segments causing kinds of inh ...

  4. Codeforces Round #115 A. Robot Bicorn Attack violence

    A. Robot Bicorn Attack Time Limit: 20 Sec Memory Limit: 256 MB Topic linking http://codeforces.com/contest/17 ...

  5. 【js data structure 】 Stack to solve the problem of PEZ Candy Box

    An example of stacks in real life is the PEZ Candy Box . Imagine you have a box of pats , It's full of red . Yellow and white candy , But you don't like yellow candy . Use stack ( It's possible to use multiple stacks ) Write a program , Without changing the stacking order of other candies in the box ...

  6. solve 360 Carry on wifi Frequent disconnection of the first connection every day

    I've tried it for a few weeks , Add new notes if necessary :solq123987654

  7. shell Programming SHELL Basics (1)

    shell Script Basics shell It's a command line interpreter , She provides an idea for interoperability linux The kernel sends requests to run the program's interface system level program , Users can use shell To start up . Hang up . Stop even writing programs . shell Or is it a merit ...

  8. Java Classic programming problems 50 The twenty third of Tao

    Give one not more than 5 Bit positive integer , requirement :① Find out how many digits it is :② Print out the numbers in reverse order . public class Example23 {    public static void main(String[] arg ...

  9. PHP Get server IP And the client IP

    <?php echo ' Front end machine IP:'.$_SERVER['REMOTE_ADDR']; echo '<br />'; echo ' Back end machine IP:'.$_SERVER['SERVER_ ...

  10. Record 1- Replace mac pro Memory , Hard disk and recovery system

    my mac pro yes 2012 I bought it at the beginning of the year ,4G/500G HDD After more than six years of service, the speed is comparable to that of an old cow , Previously installed virtual machine did not dare to open . Change the memory to 8G, Upgrade your hard disk to samsung Of 1T SSD, It's like coming back from the dead ...