每次运行此程序时,该错误都会显示在框中。
我使用Windows 10运行该程序。
import random
import msvcrt
a=random.randint(1,50)
while True:
text=('put your guess here >>>')
b=input(text)
print(b)
print(a)
while True:
pk=msvcrt.getch()
b=input(text)
if int(b)>a:
print('too large')
if int(b)<a:
print('too small')
if int(b)==a:
print('correct, you guessed the number!')
break
if pk == 'r':
a=random.randint(1,50)
print`
Traceback (most recent call last):
File "main.py", line 2, in <module>
import msvcrt
ImportError: No module named 'msvcrt'
我希望导入成功,但是没有成功。