获取呼叫命令,哪些管道进入python脚本
我有一个python脚本,可以通过管道读取数据:
cat file.txt | sort | script.py
我可以获取呼叫命令cat file.txt | sort
作为script.py中的字符串?
I have a python script which reads data via pipe like this:
cat file.txt | sort | script.py
Can I get the calling command cat file.txt | sort
as a string in script.py?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果要调用
cat file.txt |从python脚本中进行排序
,您可以执行以下os.system()
将从cat file.txt |排序
。希望这就是您想要的。
If you want to call
cat file.txt | sort
from your python script, you could do the followingos.system()
would return the output fromcat file.txt | sort
.Hope this is what you are looking for.