我想使用 python curses 模塊獲取用戶輸入,但每次它沒有在串列中添加任何元素時,任何人都可以幫助我
我的代碼:-
import curses
from curses import wrapper
from curses.textpad import Textbox, rectangle
tempo_list = []
def main(stdscr, text="hello"):
final_text = text " (hit Ctrl-G to send)"
for i in range(5):
stdscr.addstr(0, 0, final_text)
win = curses.newwin(1, 21, 2, 1)
box = Textbox(win)
rectangle(stdscr, 1, 0, 3, 23)
stdscr.refresh()
box.edit()
val = box.gather().replace("\n", "")
tempo_list.append(val)
print(tempo_list)
wrapper(main)
uj5u.com熱心網友回復:
您在列印(空)串列wrapper(main) 后呼叫。更改陳述句的順序。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/471055.html
標籤:python-3.x 列表 诅咒 蟒蛇诅咒
上一篇:如何計算字串串列中每個字串的位數
下一篇:如何將其轉換為dict
