for i, line in enumerate(open("contexttxt", 'rt')):
contextdict[i] = lines={}
s['aaaa']=['11111','22222','33333','4444444']
s['bbbb']=['aaaaa']
print s
运行结果:{'aaaa': ['11111', '22222', '33333', '4444444'], 'bbbb': ['aaaaa']}
你想表达的是这意思吗>>> keys = ['a', 'b', 'c']
>>> values = [1, 2, 3]
>>> dictionary = dict(zip(keys, values))
>>> print(dictionary)
{'a': 1, 'b': 2, 'c': 3}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)