Python子进程terminal/space需要调整为80/24以外的值
Python subprocess terminal/space need to be adjusted to a value other than 80/24
我正在使用 subprocess.Popen 在 python 中作为脚本的一部分进行调用和执行。 subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE)
。可执行文件需要在大于 80/24 的子进程 terminal/window/space 中打开,否则结果会被截断。我需要调整 input/flags 以进行子处理,以便更改列号。我试过 env= {'COLUMNS':'300'}
但没有用。
我用python2.7
subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE)
执行命令并 returns 结果文本。
import os
command = "some command"
res = os.popen(command).read() # get all content as text
res = list(os.popen(command)) # get lines as array elements
要更改终端大小,请使用
import os
rows = raw_input("rows: ")
cols = raw_input("cols: ")
os.system("resize -s {row} {col}".format(row=rows, col=cols))
我正在使用 subprocess.Popen 在 python 中作为脚本的一部分进行调用和执行。 subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE)
。可执行文件需要在大于 80/24 的子进程 terminal/window/space 中打开,否则结果会被截断。我需要调整 input/flags 以进行子处理,以便更改列号。我试过 env= {'COLUMNS':'300'}
但没有用。
我用python2.7
subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE)
执行命令并 returns 结果文本。
import os
command = "some command"
res = os.popen(command).read() # get all content as text
res = list(os.popen(command)) # get lines as array elements
要更改终端大小,请使用
import os
rows = raw_input("rows: ")
cols = raw_input("cols: ")
os.system("resize -s {row} {col}".format(row=rows, col=cols))