data=[ ["Bob",56,89], ["Jackaforius",56,33], ["Nora",90,56] ] #calc num of rows num_rows=len(data) print("num_rows",num_rows) #calc of columns num_cols=len(data[0]) first_row=data[0] num_cols=len(first_row) print("num_cols",num_cols) #print them all out for x in range(0,num_rows): print(data[x]) #print out nicely for x in range(0,num_rows): print(data[x][0]+"\t"+str(data[x][1])+"\t"+str(data[x][2]) ) #print out nicely and efficiently print("#print out nicely and efficiently") for x in range(0,num_rows): for y in range(num_cols): print(str(data[x][y])+"\t",end="" ) print() #input("Press ENTER to continue ") #print out nicely and efficiently 2 print("#print out nicely and efficiently 2") for row in data: for y in range(num_cols): print(str(row[y])+"\t",end="" ) print() #print out nicely and efficiently 3 print("#print out nicely and efficiently 3") for row in data: for cell in row: print(str(cell)+"\t",end="" ) print() #without the print end trick #construct a string and then print it out print("#print out using a string") s="" for row in data: for cell in row: s=s+str(cell)+"\t" s=s+"\n" print(s) #without the print end trick #using string formatting print("#print out using a string, using string formatting") s="" for row in data: for cell in row: s=s+"{:<15}".format(cell) #https://docs.python.org/3.4/library/string.html s=s+"\n" print(s) #list comprehension - the cool way to create lists on the fly g=[str(i) for i in range(20)] print(g) #the non-cool way h=[] for i in range(20): h.append(str(i) ) # a few more examples of lists g1="\t".join([str(i) for i in range(20)] ) print(g1) print(",".join(h)) print([int(x)*2 for x in h])