def get_terminal_height(fd=1):
"""
Returns height of terminal if it is a tty, 999 otherwise
:param fd: file descriptor (default: 1=stdout)
"""
if os.isatty(fd):
height = os.get_terminal_size(fd)[1]
else:
height = 50
return height
评论列表
文章目录