python gotoxy

import ctypes
import os
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12

os.system('cls')

class COORD(ctypes.Structure):
    _fields_ = [("X", ctypes.c_short), ("Y", ctypes.c_short)]

    def __init__(self, x, y):
        self.X = x
        self.Y = y
def gotoxy(x,y):
    hOut = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
    ctypes.windll.kernel32.SetConsoleCursorPosition(hOut,COORD(x,y))

gotoxy(5, 5)
print("test")

python gotoxy

上一篇:域名过期提前预警脚本


下一篇:redis单例模式写法