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:
Display that I actually want: