There are many ways to write stderr:
# Note: this first one does not work in Python 3
print >> sys.stderr, "spam"
from __future__ import print_function
That seems to contradict zen of Python #13 †, so what's the difference here and are there any advantages or disadvantages to one way or the other? Which way should be used?
† There should be one — and preferably only one — obvious way to do it.
If you are looking for upskilling yourself in python you can join our Python Certification and learn from an industry expert.