什么是termios.TIOCGWINSZ

2024-04-26 14:43:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我想知道终端的尺寸。我正在使用此功能:

import sys, struct, fcntl, termios

s = struct.pack('HHHH', 0, 0, 0, 0)
t = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, s)
print(struct.unpack('HHHH', t))

但是termios.TIOCGWINSZ到底是什么呢?


Tags: import功能终端尺寸stdoutsysstructpack