想使用pipe 傳遞 前一程式的output, 當作自己寫的程式 input. 

1. 須要一個 Input 指令,

2. 須要使用 loop : 這邊使用 while

3. error handleing

程式很單純, 就不解釋了 

#in.py   

while True:
 try:
    k=input('a')
    print(k)

    #這裡加入你自己的程式碼

    #prcessing K for your demand here
 

 except EOFError as e:
    print("End of input:",e)
    break

========

command line

c:\> python in.py                                 正常使用

c:\> dir | python in.py                         pine 的用法

 

文章標籤
全站熱搜
創作者介紹
創作者 cianfen 的頭像
cianfen

cianfen的部落格

cianfen 發表在 痞客邦 留言(0) 人氣(34)