writing list contents to a file

Christoph Lehmann lehmann at puk.unibe.ch
Fri Dec 13 05:03:39 EST 2002


Hi I am a newbie:
I have two lists each with the same length: i want to write its content
in the way

list1Item1  list2Item1
list1Item2  list2Item2
....
list1Itemn  list2Itemn

what's the moste elegant way?

so far I do: (but writes the lists sequentially)

for x in button_press_time:
    f.write(repr(x)+'\n')
for x in button_press_code:
    f.write(x +'\n')
f.close()
-- 
Christoph Lehmann 
Department of Psychiatric Neurophysiology 
University Hospital of Clinical Psychiatry 
Waldau 
CH-3000 Bern 60 
Switzerland 

Phone:  ++41 31 930 93 83 
Fax:    ++41 31 930 96 61 
Email:  lehmann at puk.unibe.ch 
Web:    





More information about the Python-list mailing list