我需要在字典上使用for循环来显示所有相应的值

shops = {

              'Starbucks': {
                  'type':'Shops & Restaurants',
                  'location':'Track 19'
               },

              'Supply-Store': {
                   'type':'Services',
                   'location':'Central Station'
               }
         }

for shop in shops:
    print(shop + " is a: " +shop.items(0))

我希望for循环一次获取一个项,然后获取相应的类型和位置。现在,我被困在获取相应的类型和位置。
预期产出为:
Starbucks is a Shops & Restaurants located at Track 19.
Supply-Store is a Services located at Central Station.

最佳答案

假设shops字典中的每个值都是另一个具有类型和位置的字典。
你想要的可能是-

for key,value in shops.items():
    print(key + " is a: " + value['type'] + " at : " + value['location'])

10-08 20:27