read-only character buffer, list
aaron
akuip at yahoo.com
Mon Jul 22 18:46:32 EDT 2002
Ths following message is from a previous question.....my question is what if
l = [0,1,2,3,4] is not a sequence...for example l=[.2,.009,.008,.05]
how do I handle this?
>>> l=[0,1,2,3,4]
>>> f=open('e', 'w')
>>> f.write(l)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: read-only character buffer, list
One could, of course, do the below:
>>> l = [0,1,2,3,4]
>>> f = open('e','w')
>>> f.write(''.join(map(str,l)))
More information about the Python-list
mailing list