Is it possible to redirect python output to the network using the "sys.stdout" command?

Is it possible to redirect python output to web using a redirect command? I know that we can redirect the output as follows

import sys
sys.stdout = open('file', 'w')
print 'test'

or

In a terminal like this

$ python foo.py > file

I heard that a web framework 'Django' and 'Flask'can do the trick. I wonder if using a simple command, for example, sys.stdoutredirect output to the web?

+4
source share

Source: https://habr.com/ru/post/1622510/


All Articles