0
titles =('IP','URL')
t = PrettyTable([])
list1 = ['8.8.8.8', '8.8.8.8', '8.8.8.8', '8.8.8.8', ]
list2 = ['http://www.example.com', 'http://www.example.com', ]
for title,lst in zip(titles,itertools.izip_longest(list1,list2,fillvalue="")):
    t.add_column(title,lst)

print t

Display the code outputs:

What the code provides

Display that I actually want:

What I want

Anchal Raheja
  • 29
  • 2
  • 8

0 Answers0