[英]How make input from right to left in python
I wrote rinput()
function in the input.py我在 input.py 中写了rinput()
function
from getch import getch
import os
def rinput():
weigth = os.get_terminal_size().columns
value = ""
start = 0
print("\033[?25l", end="")
while True:
char = getch()
if char == "\n":
break
value += char
if len(value) % weigth == 0:
start = len(value) - 1
print()
print(value[start:].rjust(weigth), end="\r")
print("\033[?25h")
return value
it works very easy它很容易工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.