dictionary question

张少驰 zhangsc at neusoft.com
Tue Dec 4 21:39:54 EST 2001

  I have a question about python's dictionary,I have a dictionary type variable,
such as 
dbs={'xk.dhs.org': '', 'www.symantec.com':'', 'ftp.happynet.org':''}
When I input dbs['www.symantec.com']='',I want to get the result like that:
dbs={'xk.dhs.org': '', 'www.symantec.com':['',''],'ftp.happynet.org':''}
How to realize this function? 

When I input dbs['www.symantec.com']='',how to determine if this item has exists in dbs,if item has existed, the result is still like this:
dbs={'xk.dhs.org': '', 'www.symantec.com':['',''],'ftp.happynet.org':''}
if item doesn't exist,then insert new value into dbs,How to realize this function?

When I print dbs,I like the result as follows:  
'xk.dhs.org': ''
 How to realize these function?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20011205/5dacd898/attachment.html>

More information about the Python-list mailing list