[Reading Notes] Python basics and python Basics

Source: Internet
Author: User

[Reading Notes] Python basics and python Basics
Basic Python tutorial

    • Basic Python tutorial
      • Chapter 1 Basic Knowledge
      • Chapter 2 list and tuples
      • Chapter 3 Use strings
      • Chapter 4 dictionaries when the index is poor
      • Chapter 6 conditional loops and other statements

Chapter 1 Basic Knowledge
Chapter 2 list and tuples
Chapter 3 Use strings
Chapter 4 dictionaries when the index is poor
Chapter 6 conditional loops and other statements


B. Number iteration, enumerate function, which can iterate the index-value pair where the index is provided.
Eg: for index, string in enumerate (strings ):
If 'xxx' in string:
String [index] = '[censored]'


C. Flip iteration and reversed functions. If they are not modified in the same place, the iterated objects after flip are returned.
Eg: ". join (reversed ('hello, world! ') Get '! Dlrow, olleh'


D. Sort iteration, sorted function, without modifying in situ, return the sorted list.


17. Skip loop: break, continue, while True/break statement


18. List derivation, using other lists to create a new list
Eg: [x * x for x in range (10) if x % 3 = 0] x * x two conditions
[(X, y) for x in range (3) for y in range (3)]


19. The pass statement is used as a placeholder in the code.

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.