2005年11月21日 星期一 12:05
a=[3,5,8,0]
b={}
for i in a:
b[i] = a
Qutr , qutianrang at gmail.com
2005-11-21
----- 收到以下来信内容 -----
发件人: Shi Mu
收件人: python-chinese
时 间: 2005-11-20, 18:59:46
主 题: [python-chinese] key in dictionary
在下面的代码里,如何一次把a中所有因素赋予b做key?
>>> a=[3,5,8,0]
>>> b={}
也就是,
b={3:[],5:[],8:[],0:[]}
谢谢!
_______________________________________________
Python中文技术讨论邮件列表
发言: 发邮件到 python-chinese at lists.python.cn
订阅: 发送 subscribe 到 python-chinese-request at lists.python.cn
退订: 发送 unsubscribe 到 python-chinese-request at lists.python.cn
详细说明: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20051121/62ef862b/attachment.htm
Zeuux © 2025
京ICP备05028076号