0

How would I go about printing only the keys from a dictionary in one print statement. The results which I would like to achieve is the following ...

Limit_list: Run till Abort, Kinetic, Single Scan

So far I have the following which I think is quite close.

new_dict = {'Run till Abort': 5, 'Kinetic': 3, 'Single Scan': 1}
print "Limit_list: {}".format(key for key, value in new_dict.iteritems())

The previous bit of code produces the following results...

Limit_list: <generator object <genexpr> at 0x02C39878>
Marmstrong
  • 1,686
  • 7
  • 30
  • 54

1 Answers1

0
print "Limit_list: {}".format(', '.join(new_dict))
Girish
  • 883
  • 8
  • 16