forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 3
サンプル – REPLプロンプト
TakeoTakahashi2020 edited this page Sep 23, 2021
·
2 revisions
- REPL(Read Evaluate Print Loop )プロンプトからノンブロッキングでキー入力し、それを表示します。
from sys import stdin, stdout
from select import poll, POLLIN
poller = poll()
poller.register(stdin, POLLIN)
while True:
for k, ev in poller.poll(10):
c = stdin.read(1)
n = stdout.write(c)
if c == "\r":
stdout.write("\n")