str.strip()
まあ、これは繰り返しに聞こえるかもしれませんが、私は, str.rstrip()
,のようなすべての可能性を試しましたstr.splitline()
.
if str is not '' or str is not '\n':
print str
しかし、出力に改行が入り続けます。
os.popen の結果を保存しています:
list.append(os.popen(command_arg).read())
私がするとき、私はprint list
得る
['output1', '', 'output2', 'output3', '', '', '','']
私の目標は取得することです
output1
output2
output3
それ以外の
output1
<blank line>
output2
output3
<blank line>
<blank line>