草庐IT

userChar

全部标签

python - 为什么只有一个字符被正确更改?

我的代码如下:importmsvcrtuserKeyPress=[""]x=0whereInList=0defwriteToList(char):if""notinchar:userKeyPress[whereInList]=userKeyPress[whereInList]+charwhilex==0:userChar=msvcrt.getch()userChar=userChar.decode("ASCII")if""inuserChar:whereInList=whereInList+1userKeyPress.extend("")elif""notinuserCharand"q