Insert character at a fixed position of lines

alex23 wuwei23 at gmail.com
Sat Jul 26 23:02:54 EDT 2008


Ugh, and in pointing our your inaccurate code I posted my own:

> >>> 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

That should be:

>>> f.write(line = "this doesn't work")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: write() takes no keyword arguments

Sorry about that :)



More information about the Python-list mailing list