I'm participating in online judge contests and I want to test my code with a .in file full of testcases to time my algorithm. How can I get my script to take input from this .in file?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Read from file(s) and/or stdin:
So the script normally takes test cases from stdin, and now you want to test using test cases from a file?
If that is the case, use the
<
redirection operation on the cmd line:PyUnit "the standard unit testing framework for Python" might be what you are looking for.
Doing a small script that does something like this:
And run as
You can do this in a separate file.
testmyscript.py