os.popen('stty size', 'r').read().split()
时间: 2024-01-26 16:03:16 浏览: 260
解决python3中os.popen()出错的问题
This line of code opens a new process in the operating system using the `os.popen()` method. The argument `'stty size'` specifies the command to be executed in the shell, which asks for the size of the terminal window. The letter `'r'` specifies that the output of the command should be read.
The `read()` method reads the output of the command as a string.
Finally, the `split()` method is called on the string to split it into a list of words. The result is a list containing two elements: the number of rows and columns in the terminal window, respectively.
阅读全文