arg.py (407B)
1 # standard imports 2 import select 3 import sys 4 5 6 def stdin_arg(): 7 """Retreive input arguments from stdin if they exist. 8 9 Method does not block, and expects arguments to be ready on stdin before being called. 10 11 :rtype: str 12 :returns: Input arguments string 13 """ 14 h = select.select([sys.stdin.buffer], [], []) 15 if len(h[0]) > 0: 16 v = h[0][0].read() 17 return v 18 return None