【问题标题】:Reading information in Python in a non-blocking manner在 Python 中以非阻塞方式读取信息
【发布时间】:2015-06-06 12:06:53
【问题描述】:

我需要在 Python 中读取用户的输入,但以非阻塞方式。我必须检查他是否按了一封信,一次读一个。有一个很棒的模块可以做到这一点:msvcrt。可悲的是我不能在 Ubuntu 中使用它,所以我被卡住了。我看到了一个类似的,叫做 Ubuntu 的 curses,但我不明白那个模块是如何工作的。我需要一个getch() 函数和一个khbit() 函数。 curses 模块上的getch() 行为怪异,我不知道如何操作它。我该怎么办?

【问题讨论】:

    标签: python python-2.7 ubuntu


    【解决方案1】:

    NCursos 起初看起来令人生畏。但这更像是遵循食谱而不是困难。一步一步的tutorial is here。请注意,您不一定非要进入 windows 部分。

    At the end of this page,这里有getch的使用方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-03
      • 1970-01-01
      • 1970-01-01
      • 2010-11-19
      • 1970-01-01
      • 2016-07-28
      • 2010-09-27
      相关资源
      最近更新 更多