あなたはsubprocess.check_output
を使用することができます。
In [864]: output = subprocess.check_output(['objdump -d a.out'], shell=True)
これはあなたの出力のバイト文字列を返します。その後、str.decode
を使用してデータを表示することができます。タブでインデントする場合は、改行で分割して行単位で印刷することができます。
In [870]: for line in output.decode().split('\n'):
...: print('\t', line)
...:
a.out: file format Mach-O 64-bit x86-64
Disassembly of section __TEXT,__text:
__text:
100000fa0: 55 pushq %rbp
100000fa1: 48 89 e5 movq %rsp, %rbp
100000fa4: 31 c0 xorl %eax, %eax
100000fa6: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
100000fad: 5d popq %rbp
100000fae: c3 retq
_main:
100000fa0: 55 pushq %rbp
100000fa1: 48 89 e5 movq %rsp, %rbp
100000fa4: 31 c0 xorl %eax, %eax
100000fa6: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
100000fad: 5d popq %rbp
100000fae: c3 retq
'os.system'は「出力」を返しません。整数戻りコードを返します。だから、まずは、電話の悪い選択。その文書を確認してください。 – MariusSiuram