On 2007-02-12, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2007-02-12, mech point <[EMAIL PROTECTED]> wrote:
>>
>> I was able to read the data from file into a two dimensional array
>> (lists)
>>
>> rows=[map(float,line.split())for line in file("data")]
>>
>> but How to write them back into the file.
>
> for r in rows:
> file.write(" ".join(map(str,r)) + "\n")
Doh. Bad choice of names for my file object:
f = file("data","w")
for r in rows:
f.write(" ".join(map(str,r)) + "\n")
You can do it on one line if you want, but I find the above a
little bit clearer.
--
Grant Edwards grante Yow! Spreading peanut
at butter reminds me of
visi.com opera!! I wonder why?
--
http://mail.python.org/mailman/listinfo/python-list