我用input功能從fileinput模塊通過pipes或input file這裏接受腳本是最小腳本: finput.py import fileinput
with fileinput.input() as f:
for line in f:
print(line)
使這個腳本執行後,我跑ls | ./finput.py並獲得unexpected error mes
我寫了一個小python腳本,但bash將不執行它: #!/usr/bin/python
'''
Created on Dec 19, 2014
'''
import subprocess
if __name__ == '__main__':
p = subprocess.Popen('df -h', stdout=subprocess.PIPE, stderr=su