【发布时间】:2010-08-28 22:32:44
【问题描述】:
我有一个子进程使用通信来获取输出并将其保存到我的数据库中:
p = Popen([str(pre_sync), '-avu', str(src), str(dest)], stdout=PIPE)
syncoutput = p.communicate()
check.log = syncoutput
一切正常,但从通信的输出看起来像这样:
('sending incremental file list\n\nsent 89 bytes received 13 bytes 204.00 bytes/sec\ntotal size is 25 speedup is 0.25\n', None)
全部在一行中并插入“\n”。有没有办法让它在新行中打印每一行?提前致谢。
【问题讨论】:
标签: python django django-views popen