I have an input file ("abc.in") which I will like to read each line as input()
, exactly like how it works on hackerrank and other online coding platforms.
I have seen solutions replicating the same functionality by piping, fileinput and sys etc. On hackerrank I can just use input()
to store one line of the input file as a variable. How do I do that locally? Do I store the files in the same place, what command do I use to run this in the terminal?
I thought this would be easy, but somehow I can't seem to figure out how to do it after trying for some time. Apologies if the answer was obvious.
Any help provided is greatly appreciated!