My apologies you did indeed use writelines correctly ;)
dohhh!
I had a gut reaction to this.
Py>f = ['hij\n','efg\n','abc\n']
Py> for i in f:
...     if i.startswith('a'):
...         i == ''
Py> f
['hij\n', 'efg\n', 'abc\n']
Notice that it does not modify the list in any way.
You are trying to loop thru the list and modify the items in place, it
just won't work.
When you rebind the item name to a new value ' ' it does not rebind the
element in the list just the current item.
It is also bug prone to modify a list you are looping over.
M.E.Farmer

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to