You might be wondering of how to take read a file till EOF in Python. Actually, its quite easy, but most of the Python users faces this problem initially.
Solution:
Use the following piece of code in your program. It will read the input_file till EOF and stores the data of the input file as a string.
while True:
try:
a= raw_input()
#do something...
except EOFError:
break
You can input your input_file from the terminal using following command:
python your_code.py < input_filename
To get your output in another file:
python your_code.py < input_filename > output_filename