Flush stdin

Chris Angelico rosuav at gmail.com
Sat Oct 18 21:23:00 EDT 2014


On Fri, Oct 17, 2014 at 10:38 PM, Empty Account <emptya45 at gmail.com> wrote:
> I am using netcat to listen to a port and python to read stdin and print to
> the console.
>
> nc -l 2003 | python print_metrics.py

After lengthy discussion about what it means to flush stdin, I think
it's high time someone asked the question: Why not skip nc altogether,
and have your Python program do its own socket work? Then you don't
have to worry about stream flushing at all.

ChrisA



More information about the Python-list mailing list