Python Basic Learning string manipulation

Source: Internet
Author: User


#常用的字符串操作
#somestring. Capitalize () capital letter, no parameters required
#somestring. Lower () Convert letters to lowercase
#somestring. Upper () converts letters to uppercase
#somestring. Count () The number of occurrences of the statistic parameter
#somestring. Find () Index of the lookup parameter
#somestring. Format () formatted output
#somestring. Strip () remove spaces and line breaks on both sides
#somestring. Replace (' name ', ' JXT ') # replacement string, followed by the number of times you want to replace it, and replace it all by default
#somestring. Split () converts a string to a list, with the argument as a delimiter.
#somestring. Splitlines () Converts a string to a list with a newline character as a delimiter
# ', '. Join (somelist) #将列表转换为字符串并以字符为每个值的分隔符
#somestring. EndsWith () #判断字符串是否以参数为结尾, return Boolean
#somestring. Center (50, "#") prints 50 characters, not enough parameters to fill, the string in the middle
#somestring. Expandtabs (tabsize=1) converts a tab in a string to how many spaces

#字符串判断
#somestring. IsDigit () to determine whether a string is a number
#somestring. Isalpha () Determine if the string is in plain English
#somestring. Isalnum () #判断字符串是否为英文 + digits
#somestring. Islower () to determine whether it is lowercase English
#somestring. Upper () to determine whether to capitalize English
#somestring. Isspace () to determine whether it is a space
#somestring. Isidentifier () Determine if the variable name requirements are met

Python Basic Learning string manipulation

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.