【已解决】报错_, term_width = os.popen(‘stty size‘, ‘r‘).read().split() term_width = int(term_width)

1、在运行他人程序时,以下代码报错:

_, term_width = os.popen('stty size', 'r').read().split()
term_width = int(term_width)

在这里插入图片描述

2、于是查询资料了解到:这是Linux上的写法,在windows上直接设置固定值就行了,具体可以再自行搜索一下。

3、修改办法:

将该行注释,并给参数赋值即可。

#  _, term_width = os.popen('stty size', 'r').read().split()
term_width = 80

猜你喜欢

转载自blog.csdn.net/qq_43750528/article/details/130202219