我的输出文件为每一行创建NUL字节(\ x00)。我在Unix上运行python 2.7,稍后将在Windows上处理文件
with open(inputfile,'w') as f:
f.write(cmd_output)
command_process = subprocess.Popen(
cmd,
shell=shl,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True
)
cmd_output = command_process.communicate()[0]