>>> import struct,termios,fcntl >>> struct.unpack("HH", fcntl.ioctl(0, termios.TIOCGWINSZ, " ")) (33, 108)