Python Learning notes (i)

Source: Internet
Author: User

Python Basic Property functions Learn

Import this: "The Zen of Python"

#: Annotation Characters

# ENCODING=GBK: Chinese input reference

Title (): Each word is displayed in uppercase letters, and the first letter of each word is changed to uppercase.

Upper (): Converts a string to uppercase

Lower (): Converts a string to lowercase

\ t: Tab

\ n: Line break

Rstrip (): Delete the end of the string contains extra white space, delete is only temporarily, and then access the variable value again, still contain extra white space

Lstrip (): Delete the beginning of the string with extra whitespace

Strip (): Remove extraneous whitespace at the beginning of the string

STR (): Convert to String

Append (): Add an element at the end of the list

Del: Delete the list element at any location

Pop (): Deletes the element at the end of the list by default and removes the element from any position in the list based on the incoming subscript, allowing you to continue to use it.

Remove (): Deletes only the first specified value. If the value you want to delete may appear more than once in the list, you need to

Use loops to determine if all such values have been deleted

Sort (): The list is sorted in a permanent order, and the list element is arranged in the reverse sequence, simply passing the parameter to the sort () method Reverse=true

Sorted (): Temporarily sorts the list, displays the list in reverse order, or passes parameters to the function sorted () reverse=true

Reverse (): Reverses the order in which list elements are arranged

Len (): Gets the length of the list

Range (): Starts from the specified first value and stops after the second value you specify, example range (2,11,2)

In this example, the function range () starts at 2 and then continues to add 2 until the final value (11) is reached or exceeded, so
The output is as follows: [2, 4, 6, 8, 10]

List (): Convert to List

Min (): min
Max (): Max
SUM (): Sum

Players[0:3]: You can specify the index of the first element and the last element to be used. As with function range (), Python

Stops after reaching the element that precedes the second index you specify. If you do not specify the first index, Python will automatically start at the beginning of the list.

The second index similarly

Python Learning notes (i)

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.