Common Python string operations

Source: Internet
Author: User

String. capitalize (): uppercase of the first letter of the string


String. count (): obtains the number of substrings in a string.


String. find (): obtains the starting position of a substring in a string.


String. isalnum (): checks whether the string contains only 0-9A-Za-z


String. isalpha (): checks whether the string contains only 0-9A-Za-z


String. isdigit (): checks whether the string contains only letters.


String. islower (): checks whether all strings are lowercase letters.


String. isspace (): checks whether all characters in the string are blank characters.


String. istitle (): checks whether the words in the string are uppercase letters.


String. isupper (): checks whether all strings are uppercase letters.


String. join (): connection string


String. lower (): converts all strings to lowercase letters.


String. split (): split string


String. swapcase (): converts uppercase letters in a string to lowercase letters and lowercase letters to uppercase letters.


String. title (): capital the first letter of a word in a string.


String. upper (): converts all letters in the string to uppercase.


Len (string): gets the string length.

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.