小编use*_*470的帖子

python返回两个字典

我试图退还两本字典。给person_to_friends和person_to_networks函数,而profile_file是文本文件。我写的是:

def load_profiles(profiles_file, person_to_friends, person_to_networks):
    """
    (file, dict of {str : list of strs}, dict of {str : list of strs}) -> NoneType
    Update person to friends and person to networks dictionaries to include
    the data in open file.
    """
    profiles_file = open('data.txt', 'r')
    person_to_friends = person_to_friends(profiles_file)
    person_to_networks = person_to_networks(profiles_file)    
    return person_to_friends, person_to_networks
Run Code Online (Sandbox Code Playgroud)

这只给了我person_to_friends字典。.有人可以帮助解决这个问题吗?我要退货的是

{person_to_friends} {person_to_networks}

python dictionary function

1
推荐指数
1
解决办法
8070
查看次数

标签 统计

dictionary ×1

function ×1

python ×1