Python Object-oriented

Source: Internet
Author: User

Import Cpickle as Pimport, as set import alias P.dump (Shoplist, F) do not understand
The Os.exists function verifies whether the directory already exists in the directory. If not, the Os.mkdir function is created.
target = today + Os.sep + now + '. Zip '
OS.SEP depending on the system, different separators are given
ZipFile and Tarfile
Standard library functions
The class method must set a self variable if the initial value is not set, Python automatically assigns the value object itself to the variable
Class person://def sayhi (self)://Method name print ' Hello, how is it? ' P = person ()//instantiation of P.sayhi ()//Use
a variable that belongs to an object or class is called a domain

Self refers to the object itself, which is the first default parameter, and Python calls this value if the variable is not assigned a value

When you call this object's method Myobject.method (Arg1, arg2), this is automatically converted from Python to Myclass.method (MyObject, arg1, arg2)

The __init__ method, which is created when a double underline object is established, initializes the work
As keyword to modify the call name of a third-party library Improt WebBrowser as Web
StartsWith (")//Verify Start string
in//verifies whether the string
Check the character if ' a ' in name:print ' 1 '
Test.find ("a") returns 0 is found to return-1 is not found

Jointest1 = ["Test1", "Test2", "test3"]test2 = "_*_" Print Test2.join (test1) Split string
Time.strftime ()
Get Date and time

From for notes (Wiz)

Python Object-oriented

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.