0

Assuming I have the following list:

ListofLists = [2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13] 

I want to add the list of lists to the body of a email, something like that:

body = "Here are the informations" + ListofLists 

I would like to seperate the two lists and print the lists each in a seperate line, so it looks like a table, how could I do that?

What I want as an Output is the following:

Number 1  Number 2  Number 3  Number 4  Number 5  
   2         3         4         5         6
   8         9        10        11        11
Shadowlight
  • 15
  • 1
  • 7

2 Answers2

0

is this what you mean:

listOfLists = [2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13]

body = ("here are the informations")

for a in listOfLists:
    print(body + str(a))

output looks like:

here are the informations[2, 3, 4, 5, 6, 7]
here are the informations[8, 9, 10, 11, 12, 13]
0

This code:

listOfLists = [[2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13]]
for i in range(len(listOfLists[0])):
    print('Number',(i+1), end = "  ")
for i in range(len(listOfLists)):
    print()
    for j in listOfLists[i]:
        print('  ',j, end = (7-len(str(j+1)))*' ')

makes output like this:

Number 1  Number 2  Number 3  Number 4  Number 5  Number 6  
   2         3         4         5         6         7      
   8         9        10        11        12        13     
Goran7T
  • 76
  • 1
  • 4
  • 5