Re: [問題] 如何持續更新print內容
有找到一個比\r好用
curses (https://goo.gl/ivB5YG)
import curses
import sys
import time
from datetime import datetime
import random
def main(stdscr):
for i in range(10):
stdscr.clear()
stdscr.addstr("CurrentTime: %s\n" % datetime.now())
stdscr.addstr("Num: %d\n" % (i+1))
stdscr.addstr("Choice: %s" % ['a', 'b', 'c', 'd'][random.randint(0, 3)])
time.sleep(0.5)
stdscr.refresh()
main(curses.initscr())
※ 引述《renshin (阿信)》之銘言:
: 各位大大好
: 想請教如何持續更新顯示內容
: 目前google查到都只能處理一行
: 若我的內容有多行以上可以如何達到這個功能呢?
: ex:
: 現在時間:A
: 人數:B
: 其他:C
: 以上是顯示範例
: 希望能在print的時候永遠只顯示3行,只更新ABC變數
: 還請大大們教學,感恩
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.163.214.81
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1537624189.A.F5D.html
→
09/25 10:58,
6年前
, 1F
09/25 10:58, 1F
→
09/25 10:59,
6年前
, 2F
09/25 10:59, 2F
→
09/25 12:04,
6年前
, 3F
09/25 12:04, 3F
討論串 (同標題文章)
Python 近期熱門文章
PTT數位生活區 即時熱門文章