__DICT__ Learning notes in the Python class __python

Source: Internet
Author: User

followed the blog to learn a little Python knowledge
dict: Class with all members of the object;
The class outputs information such as global functions, variables, and so on.
Object output is just a generic variable owned by the object.

# http://python.jobbole.com/83747/
Class Province:
    country = ' in ' '

    def __init__ (self, Name, count):
        self.name = name
        Self.count = Count

    def func (self, *args, **kwargs):
        print ' func '

print province._ _dict__
obj1 = Province (' Hebei ', 10000)
print obj1.__dict__
obj2 = Province (' Henan ', 3888)
print obj2.__dict__
{' Country ': ' __module__ ': ' __main__ ', ' func ': <function func at 0x1074191b8>, ' __init__ ': <function __i Nit__ at 0x1074190c8>, ' __doc__ ': None}
{' Count ': 10000, ' name ': ' Hebei '}
{' count ': 3888, ' name ': ' Henan '}

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.