gpt4 book ai didi

cygwin - Python 2.7.2,Cygwin,raw_input : why does it only print the prompt after I give the input?

转载 作者:行者123 更新时间:2023-12-01 04:35:40 26 4
gpt4 key购买 nike

我有这个 python 程序:

import board

theBoard = board.Board()
theBoard.setup_new_game()
theBoard.display()

inputStr = raw_input('Enter move \"x y\":')
print inputStr

Board是我写的一个类,显示黑白棋盘。当我运行这个程序时,它立即停止并等待输入。当我输入内容并按回车键时,它会显示面板并在其下方显示输入提示。

我是否需要使用诅咒之类的东西来让它正常运行,还是我只是缺少一些基本的东西?据我所知,这应该打印板,打印提示,然后等待我提供输入。

最佳答案

通常这是因为输出没有被正确刷新。有时,出于效率原因,输出驱动程序会等待实际打印文本,直到它认为需要打印文本,但有时它会导致诸如此类的问题。我不知道使用您正在使用的 API 进行刷新的确切接口(interface),但应该很容易找到。

关于cygwin - Python 2.7.2,Cygwin,raw_input : why does it only print the prompt after I give the input?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10801693/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com