How to save python screen output to a text file

前端 未结 10 1010
星月不相逢
星月不相逢 2020-12-08 06:16

I\'m new to Python. I need to query items from a dict and save the result to a text file. Here\'s what I have:

import json
import exec.fullog as e

input = e         


        
10条回答
  •  抹茶落季
    2020-12-08 06:44

    python script_name.py > saveit.txt
    

    Because this scheme uses shell command lines to start Python programs, all the usual shell syntax applies. For instance, By this, we can route the printed output of a Python script to a file to save it.

提交回复
热议问题