Python judgment string and case conversion

Source: Internet
Author: User

This article mainly introduces the Python judgement string and the case conversion method, the need for the small partner can refer to.

Judgment string

?

1 2 3 4 5 6 7 S.isalnum () #所有字符都是数字或者字母 s.isalpha () #所有字符都是字母 s.isdigit () #所有字符都是数字 s.islower () #所有字符都是小写 s.isupper () #所有字符都是大写 S.istitle () #所有单词都是首字母大写, like the title S.isspace () #所有字符都是空白字符, T, n

Case conversion

?

1 2 3 4 S.upper () #把所有字符中的小写字母转换成大写字母 s.lower () #把所有字符中的大写字母转换成小写字母 s.capitalize () #把第一个字母转化为大写字母, remaining lowercase s.title () # Converts the first letter of each word to uppercase, and the remaining lowercase

The above mentioned is the entire content of this article, I hope you can enjoy.

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.