KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a script that creates output with sys.stdout.write() and sys.stderr.write() . Recently I've posted a couple questions about other aspects of the script and I've noticed that people posting answers seem to prefer print('some text', file=sys.stdout) . My primary concern with the output is simply that it can be piped by the shell, either into a file or as input to another program. Can someone please explain (or direct me to an existing explanation) the differences between print() and sys.stdout.write , the cases in which each should be used and the rational for those conventions?
Tags (comma-separated)
Save Edits
Cancel