[Tutor] silly remedial question

kevin parks kpp9c at virginia.edu
Mon Nov 24 03:02:53 EST 2003


Hi folks!

I am trying to do something that seems rather simple, but perhaps is 
something i haven't done before or forgot...

I have a function that does something to sequence and returns a 
sequence. Now i call that function a bunch of times one a whole bunch 
of lists and i get my output which is very nice. Problem is, that i 
want to make that output more humanly readable form by first printing 
the name of the list variable followed by a ' = ' and then the items in 
the list.

so if sequence input_01 = [22, 25, 31] and i write something that 
returns the mod 12 equivalent of each item in a new list [10, 1, 7]

i can print [22, 25, 31] and [10, 1, 7]
but how can i get it to say :

input_01 = [22, 25, 31], [10, 1, 7]

Without saying:

print 'input_01 =', input_01

for each input list.

I can print the input and output lists no problem, but how do you tell 
python to print the variable itself.. I don't want to do this by hand 
as i have a huge bunch of list that i have to do this to that are 
already sitting in a text file.

Not sure i made this clear or not...


cheers,

kevin




More information about the Tutor mailing list