On Jul 27, 9:26 am, Lie Ryan <[EMAIL PROTECTED]> wrote:
> Btw, if you do f.write('line = line[:22] + "A" + line[23:]'), you'd
> output exactly that, and not inserting the 23rd character, you'd want to
> do this instead: f.write(line = line[:22] + "A" + line[23:])

Please check your examples before further confusing an already
confused poster.

You -cannot- assign within a function call. What you're doing there is
claiming line is a keyword argument:

>>> f = open('dummy.txt','w')
>>> f.write(line = 'this doesn't work')
  File "<stdin>", line 1
    f.write(line = 'this doesn't work')
                               ^
SyntaxError: invalid syntax

What you meant, of course, was:

>>> f.write(line[:22] + "A" + line[23:])
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to