我希望两个玩家在(石头、纸或剪刀(之间做出选择,而其他玩家不会看到他们选择了什么。
代码:
player1_choice = getpass.getpass (prompt='n[rock]n[paper]n[scissors]nPlayer 1 please choose:')
代码运行:
Warning (from warnings module):
File "C:UserstalhaAppDataLocalProgramsPythonPython38-32libgetpass.py", line 100
return fallback_getpass(prompt, stream)
GetPassWarning: Can not control echo on the terminal.
Warning: Password input may be echoed.
[rock]
[paper]
[scissors]
Player 1 please choose: rock #(I want 'rock' input to be hidden, yet is still being showed)
问题很可能是由IDLE本身引起的。尝试在普通终端中运行相同的代码:
python your_game.py