I have a list
and a list of list
like this
>>> list2 = [["1","2","3","4"],["5","6","7","8"],["9","10","11","12"]] >>> list1 = ["a","b","c"]
I fixed the two above lists so that I can match their index value by index.
>>> mylist = zip(list1,list2) >>> mylist [('a', ['1', '2', '3', '4']), ('b', ['5', '6', '7', '8']), ('c', ['9', '10', '11', '12'])]
Now I tried to print the output above mylist
using
>>> for item in mylist: ... print item[0] ... print "---".join(item[1]) ...
As a result, this result was my desired output
.
a 1---2---3---4 b 5---6---7---8 c 9---10---11---12
Now, my question is: is there a cleaner and better
to achieve the desired result, or is this a possible best(short and more readable)
.