[EMAIL PROTECTED] writes:

> import string

Why import 'string' if you're not using it?

> f=open('/test/test.asc','r')
> o=open('/test/out.asc','w')
> for line in f:
>     s= f.readline()

Your line object is already bound to the 'line' name in each
iteration. You need to use that, not attempt to read yet another line
each time.

That is, instead of::

    for line in f:
        foo = f.readline()
        do_interesting_thing(foo)

you should do this::

    for line in f:
        do_interesting_thing(line)

-- 
 \     "The cost of a thing is the amount of what I call life which is |
  `\       required to be exchanged for it, immediately or in the long |
_o__)                                    run."  -- Henry David Thoreau |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to