标签:apn cmd output file 换行 UI read pen 结果
os.popen(cmd) .read() 获取执行后的结果自动带有换行符\n
>>> a=os.popen("ls ./soapnuke_output/CL100006359_L01_8 |wc -l")
>>> a
<open file ‘ls ./soapnuke_output/CL100006359_L01_8 |wc -l‘, mode ‘r‘ at 0x7f66e8038c00>
>>> a.read
<built-in method read of file object at 0x7f66e8038c00>
>>> a.read()
‘17\n‘
>>> b=os.popen("echo bb")
>>> b
<open file ‘echo bb‘, mode ‘r‘ at 0x7f66e8038c90>
>>> b.read()
‘bb\n‘
os.popen(cmd) .read() 获取执行后的结果且带有换行符\n
标签:apn cmd output file 换行 UI read pen 结果
原文地址:https://www.cnblogs.com/koujiaodahan/p/8830455.html