i would prefer: for case in xrange(input()): do something with case print 'Case %d: %s' % (case + 1, output)
and then: $ python script <input > output On Fri, Aug 28, 2009 at 11:22 AM, Ronaldo Osure<sureron...@gmail.com> wrote: > Yeah! Exceptions are a must when handling files! > > On Fri, Aug 28, 2009 at 11:22 AM, Rodrigo Augosto C. > <rodrigo.augo...@gmail.com> wrote: >> >> Great.!!! >> >> Or you can to use arguments. I always recommend to handle exceptions using >> try >> >> try: >> f = open(sys.argv[1], 'r') >> ... >> f.close() >> except IndexError: >> print 'IndexError: Too few arguments' >> >> >> -- >> coto >> >> >> On Fri, Aug 28, 2009 at 03:21, Ronaldo Osure <sureron...@gmail.com> wrote: >>>> >>>> To read and write to a file in python is very easy. Find attached a >>>> quick solution to this. >>> >>> You can place it at the top of the file before you begin coding. >>> Hope it helps! >>> >>> >>> >> >> >> > > > > > -- M@ http://matteolandi.altervista.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to google-code@googlegroups.com To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-code?hl=en -~----------~----~----~----~------~----~------~--~---