In windows command line, I am using the redirection operator ("<") to read input from a file. To run my python module, I would do something like:
python myscript.py <input.txt
In myscript.py
, I am using sys.stdin.readline()
to read the input stream, something like:
def main(argv):
line = sys.stdin.readline()
while line:
doSomething()
line = sys.stdin.readline()
if __name__ == "__main__":
main(sys.argv)
This works find on the command line.
Is there a way to use the redirection command in IPython? I want to debug the file. Thanks.
I am running Python 3.5.1:: Anaconda 2.5.0 on Win64.