输入操作时?
嘿,我正在开发一个 python 项目,该项目需要花费几分钟的时间。问题是,由于需要几分钟,我希望用户能够按 Enter 键来查看操作的当前状态。我怎样才能在 Python 2 中做到这一点?
Hey I'm working on a python project that requires an action that takes a couple minutes. The thing is since it takes a couple minutes I'd like the user to be able to press enter to see the current status of the action. How can I do this in Python 2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@Space_C0wb0y 是对的,进度条是一个很好的解决方案。然而,这展示了一种完成您要求的方法。从这里摘取了一些代码: Non-blocking read on a subprocess.PIPE in python
@Space_C0wb0y is right, a progress bar is a good solution. However, this demonstrates one way to do what you asked for. Some code pinched from here: Non-blocking read on a subprocess.PIPE in python