Well, there is a lot of material involving the Python IO modules, via
command line you should use the command line arguments.
http://stackoverflow.com/questions/4117530/sys-argv1-meaning-in-script


On Sun, Apr 14, 2013 at 10:27 PM, wonjun <wonj...@gmail.com> wrote:

> Hello All,
>
> I mainly code in Python, and is quite confused with the IO part.
> Well I normally do the following for IO:
>
> f = open('filename','r')
> a = f.read()
> b = a.split('\n')
>
> Now, depending on the problem at hand, I use a for loop / while loop to
> look over all cases and solve them accordingly.
> I believe this is time consuming (when there is a very big input), and
> when I download the solution, they all are written something like this:
>
> (Code taken from the Analysis for Tic-Tac-Toe-Tomek)
>
> numcases = int(sys.stdin.readline())
> for casenum in range(1,numcases+1):
>    board = []
>    for i in range(0,5):
>      board.append(sys.stdin.readline().strip())
>    print 'Case #' + repr(casenum) + ': ' + solve(board)
>
>
>
> Now, when we run this code, we have to manually write down everything -
> and then it will solve the problem. Is there a way to do it via command
> line to solve everycase in one go?
>
> And, is there any good material on Python IO which touches on stuff like
> above?
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-code+unsubscr...@googlegroups.com.
> To post to this group, send email to google-code@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to