Python Dictionary method

Source: Internet
Author: User

Method

Describe

Adict.clear ()

Remove all items from the adict

Adict.copy ()

Returns a copy of Adict

Adict.fromkeys (seq[, Val])

Returns the dictionary of the key obtained from the seq and the value set to Val (the default value ofVal , None). Can be called directly on the dictionary type dict as a class method

Adict.get (key[, default])

If Adict[key] exists, return it, or return the given default value (default is None)

Adict.has_key (Key)

Check if adict has a given key

Adict.items ()

Returns a list of (key, value) pairs that represent adict items

Adict.iteritems ()

returns an iterator to the same (key, value) pair returned from and adict.items

Adict.iterkeys ()

returns an iterative object from the adict key

Adict.itervalues ()

returns an iterative object from the value of adict

Adict.keys ()

Returns a list of adict keys

Adict.pop (key[, d])

Removes and returns the value of the given key key or given default value d

Adict.popitem ()

Removes any item from the adict and returns it as a (key, value) pair

Adict.setdefault (Key[,default])

Returns the given default value if Adict[key] exists (default is None) and binds the value of Adict[key] to the default value

Adict.updata (Other)

Add each item in other to a.dic (it may overwrite the existing item). You can also call using A parameter similar to the dictionary constructor adict

Adict.values ()

Returns a list of values in Adict (possibly including the same)

Python Dictionary method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.