Python Learning series--str type

Source: Internet
Author: User

  1. The built-in method of Str.

    __contains__ () determines whether a particular character is contained in a string. Equivalent to the ' in ' keyword.

    __format__ () string formatting.

    Capitalize () first letter capitalized.

    Center () Centers the characters when they are printed.

    Count () calculates the number of occurrences of a neutron sequence of characters. You can specify the starting and ending positions.

    EndsWith () determines whether to end with a character or a sequence of words.

    Expandtabs () Converts the tab in a string to a space, and the default is 1 tab for 8 tabs.

    Find () finds the given subsequence in a string and returns the location of the subsequence. You can set the start and end positions. If not found, returns-1.

    Index () finds a subsequence in the string, similar to find (), throws an exception if it is not found.

    The format () string is formatted.

    Isalnum () Determines whether the string is in alphanumeric format.

    Isdecimal () Determines whether the string is decimal.

    Islower () are all lowercase.

    Isspace () is a space.

Whether Istitle () is a title. The title is the first letter of each word is capitalized.

Join () Stitching string.

Ljust () Adjusts the position of the string to print to the left, similar to center ().

Rjust () Adjusts the string to the right.

Strip () Crops the string, class Lstrip (), Rstrip ().

Partition () splits the original string by the given string.

Replace () replaces the specified character.

RFind () Search from right to left.

Rindex ()

Rpartation () splits from right to left.

Split () splits the string with the specified characters.

Rsplit () splits from right to left.

Splitlines () automatically splits strings based on rows. Use \ n Split.

StartsWith () determines whether to start with a character.

Swapcase () uppercase and lowercase conversions.

Title () converts the string to a caption, which is capitalized in the first letter.

Upper () capitalizes the first letter of the string.



Python Learning series--str type

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.