Python basic growth path four-basic data type method

Source: Internet
Author: User

1, three major processes of program development:
    1. Order--execute code from top to bottom
    2. Branching-determines the branch that executes the code, judging by the condition
    3. Loop--to let specific code repeat the execution

2,whlie Loop statement:
    1. Break when a condition satisfies, exits the loop and does not execute subsequent duplicate code.
    2. Continue when a condition is met, no subsequent code is executed.
3, String method
  • Join concatenation string
  • Count finds the number of occurrences of a string
  • Capitalized capitalize the first letter of the entire string
  • Add a corresponding string to both sides of center
  • EndsWith to see if a string ends with a content and returns a Boolean value
  • StartsWith to see if a string starts with a content and returns a Boolean value
  • Expandtabs converts the tab symbol in a string to 8 spaces
  • Find to view the position of a content in a string and return the index
  • Format formats the output in a value-assigned manner
  • Format.map format the output in a dictionary
  • Index is the same as Find method, no error will be
  • Isalnum determines whether a string is a number or a letter
  • Isdecimal determine if the number is a decimal
  • IsDigit Judging whether it is a number
  • Isalpha to determine if it is a letter
  • Isidentifier determine if it is an illegal variable
  • Islower determine if the string is all lowercase
  • Isupper determine if the string is all uppercase
  • Isspace to determine if a string has spaces
  • Istitle to determine if the first letter in a string is uppercase
  • Lower string All lowercase
  • Upper string All uppercase
  • Swapcase string uppercase to lowercase, lowercase to uppercase
  • Liust string followed by a corresponding number character
  • Rjust string preceded by a corresponding number character
  • Strip to remove spaces and line breaks from a string
  • Lstrip only the left space and newline characters of the string are removed.
  • Rstrip only the whitespace and newline characters to the right of the string are removed.
  • Replace replaces some characters in a string with other characters
  • Split divides a string into a list by a content
  • Title The first letter of each part that is not separated by a letter
  • Copy copies a list to be received with a variable
4, List method: Increase

      

      • Append is appended from the back, only one at a time
      • Insert is inserted by index, only one at a time
      • Extend iterative Append
By deleting
      • Remove is deleted by element, only one at a time
      • Pop is deleted by index and can also be sliced with step size
      • Clear Empty List

Del

Delete entire list

Delete by index

Delete by Slice plus step

Change
      • To change by index
      • By Slice plus step change

Check
      • According to the need, slice plus step to check
      • Use for loop to check

Other methods
      • Len () query list length
      • Count counts the number of occurrences of an element
      • Index is indexed by element
      • Sort sorted list, reverse=true in parentheses is from big to small
      • Reverse Flashbacks List
      • Enumerate for A For loop, add sequence numbers to sequences
5, Dictionary methodIncrease
      • SetDefault is not moving, no increase
By deleting
      • Pop button Delete
      • Popitem Delete the last
      • Clear Clear
      • Del Delete key or full divide
Change
      • Update merges another key-value team into one, the same overlay, without adding
Check
      • Get has a return value, no null is displayed
      • Keys
      • Values
      • Items

6, the collection method increases
      • Add a String
      • Updata Iterative Add-on
By deleting
      • Remove by Element
      • Disjird the collection of the delete, with remove delete is the same, no no error
      • Pop randomly deletes an element
      • Clear Empty Collection
      • Del Delete Entire collection
      • Intersection "& or intersection"
The collection "| or union "difference set"-or difference "inverse intersection" ^ or symmetric_difference "subset and superset" < or > "Frozenset immutable Collection, making the collection an immutable type

Python basic growth path four-basic data type method

Related Article

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.