Python: how to print and format rows from API results

I am very new to python and I am trying to print API results in a nice format. Currently when I print the results which is host information, it prints the information in the format below:

{'ip': u'', 'id': 3 'name': u''}
{'ip': u'', 'id': 6 'name': u''}
{'ip': u'', 'id': 8 'name': u''}
{'ip': u'', 'id': 5 'name': u''}
and so on...

I would like to have it print like the following if possible. Eventually I am going to try to write to an html file but for now I just want to get a nice format for printing:
IP:   ID: 3   Name:
IP:   ID: 6   Name:
and so on..

Below is part of the code that I have. I have omitted some of the code but have put the dict and list that I have created and the print command.
listHost = []
outputlist = []
#Getting API results
for host in listHost['results']
#My Dictionary and list
             info = {}
             info['id'] = host['id']
             info['id'] = host['name']
             info['ip'] = host['ip']

for row in outputlist:
             print str(row)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

on the last line instead of
print str(row)
print 'IP: {0},\tID: {1},\tName: {2}'.format(row['ip'], row['id'], row['name'])

also      info['id'] = host['name']
probably shoud be      info['name'] = host['name']

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
This is a good commend by brendanmeyer. Anyway, there is one more readable approach when formatting the things from a dictionary. It is less error prone if you have more items in the dictionary and if you write more string templates with the placehodlers. Try the following:

info = {'ip': u'', 'id': 3, 'name': u''}
print 'IP: {ip}   ID: {id}   Name: {name}'.format(**info)

Open in new window

The difference is that it is possible to use named placeholders instead of the numbered ones -- see the doc 

In the case, you need to supply keyword arguments. You can get them from the dictionary using the two stars in front of the name.

In Python 3, you can use new str.format_map(info) instead.
staten12Author Commented:
Thank you brendanmeyer. That solution worked. I had attempted to use the .format but did not have it in the correct place. I also had the info['name'] = host['name'] correct. Just a typo when I submitted the question. Again, thanks for your help.
staten12Author Commented:

Thanks for the information. It will be useful for other python scripts that I will be writing. I didn't include anything inside the {} for info because I first had to get that information from the API results that I was getting.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.