1

I want to create a log of all the print functions and save it in a file which I can display on Flask HTML page. The script is very complex but some what like below:

def main():

   def one function():
    # do something
     print(response)
   def other function():
     print(response2)
......

if __name__ == '__main__':
    import sys
    sys.exit(main())
quamrana
  • 37,849
  • 12
  • 53
  • 71
  • Can you use shell redirection? For example, `python myscript.py > output.txt` – Thomas Oct 11 '22 at 10:36
  • 1
    Does this answer your question? [How to capture stdout output from a Python function call?](https://stackoverflow.com/questions/16571150/how-to-capture-stdout-output-from-a-python-function-call) – gre_gor Oct 11 '22 at 14:20

0 Answers0