Python string manipulation

Source: Internet
Author: User

1. Case conversion

Judging a string

<textarea class="crayon-plain print-no" style="font-size: 12px !important; line-height: 15px !important; z-index: 0; opacity: 0; overflow: hidden" readonly="" data-settings="dblclick">s.isalnum () #所有字符都是数字或者字母 s.isalpha () #所有字符都是字母 s.isdigit () #所有字符都是数字 s.islower () #所有字符都是小写 s.isupper () #所有字符都是大写 S. Istitle () #所有单词都是首字母大写, like the title S.isspace () #所有字符都是空白字符, \ t, \ n</textarea>
1234567 s. Isalnum() #所有字符都是数字或者字母 s. Isalpha() #所有字符都是字母 s. IsDigit() #所有字符都是数字 s. Islower() #所有字符都是小写 s. Isupper() #所有字符都是大写 s. Istitle() #所有单词都是首字母大写, like the title s. Isspace() #所有字符都是空白字符, \ t, \ n

Uppercase and lowercase conversions

<textarea class="crayon-plain print-no" style="font-size: 12px !important; line-height: 15px !important; z-index: 0; opacity: 0; overflow: hidden" readonly="" data-settings="dblclick">s.upper () #把所有字符中的小写字母转换成大写字母s. Lower () #把所有字符中的大写字母转换成小写字母s. Capitalize () #把第一个字母转化为大写字母, remaining lowercase s.title () # Convert the first letter of each word to uppercase, the remaining lowercase</textarea>
1234 s. Upper() #把所有字符中的小写字母转换成大写字母 s. Lower() #把所有字符中的大写字母转换成小写字母 s. Capitalize() #把第一个字母转化为大写字母, remaining lowercase s. Title() #把每个单词的第一个字母转化为大写, remaining lowercase

Python string manipulation

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.