Python Basic Tutorial Second Edition reading notes

Source: Internet
Author: User
  • The first piece of basic knowledge
  1. Module
    • Import module: The format module when using the function. function

    • From module Import function: Format function when using function

  2. String
    • ' x ' anti-quotes (not single quotes ', also available with repr function), can change the value x to a string, for example x=1,print "Hello" +x (Error), print "Hello" + ' x ' (right)
    • R-Primitive string, or \ will not be used as an escape symbol, e.g. R "c:\n"
  • Chapter II List and Ganso (list can be modified, meta-ancestors can not be modified)
  1. List x=[' A ', 1] y=[' B ', 2] c=[x,y]
    • Index 0-The first one represents the last
    • Shard n=[1,2,3,4,5,6,7,8,9,10] X=n[1:4] (the first element to be displayed subscript: The remaining first element subscript 2,3,4); step X=n[1:9:2] (2,4,6,8)
    • Sequence addition a=[1,2,3] b=[4,5,6] a+b=[1,2,3,4,5,6]
    • Multiplication a=[1,2,3] a*2=[1,2,3,1,2,3]
    • Membership "in" a= "HW" ' W ' in a Returns True, ' R ' in a returns false

Python Basic Tutorial Second Edition reading notes

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.