Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Column Print?
#3
(Mar-22-2020, 09:27 AM)ibreeden Wrote: You should print the lists just like the header.
print(f"{str_:<20} {list_:<20} {tuple_:<20} {dict_:<20} {set_:<20}")
...
print(f"{str_list[i]:<20} {list_list[i]:<20} {tuple_list[i]:<20} {dict_list[i]:<20} {set_list[i]:<20}")
But where does the index "i" come from? You will have to put this second print statement in a loop (for or while) where "i" increments from 0 to the maximum.
Try this and let us know what errors you get.


TypeError: list indices must be integers or slices, not list
Reply


Messages In This Thread
Column Print? - by Guga - Mar-21-2020, 05:07 PM
RE: Column Print? - by ibreeden - Mar-22-2020, 09:27 AM
RE: Column Print? - by Guga - Mar-22-2020, 10:05 AM
RE: Column Print? - by ibreeden - Mar-22-2020, 11:33 AM
RE: Column Print? - by Guga - Mar-22-2020, 11:48 AM
RE: Column Print? - by ibreeden - Mar-22-2020, 12:13 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020