Printing an output without using print() statement

print() is generally used in Python to print an output. Another way of printing output without print is by using the stdout.write()

stdout.write() is part of sys module. Sys module can perform Input and output operations using the below:

  • stdin
  • stdout
  • stderr
As mentioned above, using stdout, we can output data using the below code:

import sys
sys,stdout.write("py-programmers.blogspot.com")

Note: you need not install sys module separately using pip.

Post a Comment

0 Comments