我已经找了几个小时了,但没有找到任何有用的东西,所以我想我只能直接问了。我一直在试着使用咒语,但无论我怎么做都行不通。我的代码是-
import curses
from curses.wrapper import wrapper
def main(scr):
scr.box()
scr.refresh()
c = scr.getch()
wrapper(main)但我得到的错误是
Traceback (most recent call last):
File "/Users/Desktop/Code/Code.py", line 3, in <module>
from curses.wrapper import wrapper
ModuleNotFoundError: No module named 'curses.wrapper'有人能帮上忙吗?
发布于 2017-05-30 01:39:42
由于您试图将wrapper函数视为一个类,因此import不起作用。这是可行的:
import curses
# from curses.wrapper import wrapper
def main(scr):
scr.box()
scr.refresh()
c = scr.getch()
curses.wrapper(main)也是这样做的:
import curses
from curses import wrapper
def main(scr):
scr.box()
scr.refresh()
c = scr.getch()
wrapper(main)https://stackoverflow.com/questions/44247882
复制相似问题