Python Learning Note 05

Source: Internet
Author: User

?

Class

Inheritance: Single inheritance, multiple inheritance

Method: Start with self, similar to this in C #

Properties: Direct Write variables

Object: Using the class name () construct

__init__ (): constructor

?

#多继承

class ? A (object):

???? .............

class ? B (object):

???? .............

class ? C (A, b):

?

?

Classrcdbase(object):

?

RecordID = ""

?

def __init__ (self):

Print' call Rcd Base __init__ '

?

def Getrecordid (self):

Return to self. RecordID

?

Classrcdheader(rcdbase):

def __init__ (self):

Print' call Rcdheader __init__ '

ReturnSuper(rcdheader, self). __init__ ()

?

CreateDate = ""

Createtime ="2015-8-6"

Softwarename = "IMC"

?

Header = rcdheader()

Print header. Createtime

Print header. Softwarename

?

?

All non-class notation is literal .

The list literal is []

__ADD__ is actually an internal structure of operator overloading

Method of List

Print dir (list)

#print Help (list)

NL = [1,3,5,7]

Nl.append (' PZ ')

Print nl.append (3), NL

Print Nl.count (3)

Print nl.index (' PZ ')

Print Nl.insert (0,12), NL

Print Nl.pop (2)

Print nl,nl.pop ()

Print nl.reverse (), NL

Print Nl.sort (), NL

?

Print [+] + [5,6,9]

?

Python Learning Note 05

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.