Different way to output string: print and sys.stdout.write : stdout stderr « Development « Python






Different way to output string: print and sys.stdout.write

Different way to output string: print and sys.stdout.write
X = 99

print X

import sys
sys.stdout.write(str(X) + '\n')


           
       








Related examples in the same category

1.Use system function to outputUse system function to output
2.Introducing stdout and stderrIntroducing stdout and stderr
3.Redirecting stdout and stderr OutputRedirecting stdout and stderr Output
4.Redirecting Error Information
5.Printing to stderrPrinting to stderr