Standard Input from a File
I'd like to use Pythonista for coding competitions (practice). On my Windows box, I typically create one file for the solution and multiple files for each test case. Running the solution with a test case looks something like this:
Any suggestion for how to achieve this in Pythonista? Ideally I don't want to open a file from within solution.py, but if there is no other solution I'll create some boilerplate code at the beginning of my solutions. I'd like to be able to copy/paste the solution (under the boilerplate if necessary) into the judgeing application. Thus, I would not need to change the following line before submitting for judement:
n,m = map(int, raw_input().split())
StaSH. I don't have the link offhand, but if you search the forums it should turn up. It has a terminal emulator built in that should handle piping.
StaSH did the trick!
I followed the instructions here:
After installing I could run solution and test with this command:
cat input1 | python solution.py
thanks a lot blmacbeth
Glad to help :)