remove a dictionary form a list

python的列表类型List中元素可以是一个字典(Dictionary)

比如一个字典:

d={key:value,key1:value1,…}

一个列表:

l=[item,item1…]

插入

>>>l.insert(1)

>>>l

[item,{key:value,key1:value1,…},item1…]

搜索

>>>d in l

true

修改

>>>l[key2]=value2

>>>l

[item,{key:value,key1:value1,key2:value2…},item1…]

删除

>>>l.remove(l)

>>>l

[item,itme1…]

Advertisements
此条目发表在Python分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s