[英]How to redirect output to file instead of printing on screen and run a python code, all in background?
以下是我的小python代碼:
from __future__ import print_function
for i in range(0,10000):
print (i**2)
要運行此代碼,請在Ubuntu的終端中鍵入以下內容:
(time python trial_tail.py) & > trial_haha.t &
這不會將輸出寫入名為trial_haha.t的文件,並在屏幕上打印出來。 如何使其寫入文件而不是在屏幕上並在后台運行?
感謝Abhinav
{ time python trial_tail.py ; } &> trial_haha.t &
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.