Lyphereus

redirectionKB

Oct 12th, 2025
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import sys
  2. class Redirect(object):
  3.     input = None
  4.     output = None
  5.  
  6.     def __init__(self,inObj,outObj):
  7.         self.input = inObj
  8.         self.output = outObj
  9.  
  10.     def readline(self):
  11.         response = self.input.readline()
  12.         self.output.write(response)
  13.         return response
  14.  
  15. if __name__ == "__main__":
  16.     if not sys.stdin.isatty():
  17.         sys.stdin = Redirect(inObj=sys.stdin,outObj=sys.stdout)
  18.  
  19.     a = input("Enter a String:")
  20.     b = input("Enter another String:")
  21.     print("Entered strings include: {} and {}".format(repr(a),repr(b)))
Tags: keyboard
Add Comment
Please, Sign In to add comment