String case-insensitive conversion in python

Source: Internet
Author: User

A summary of the functions used to convert the case sensitivity of strings in python and determine the case sensitivity of strings:

I. case-sensitive conversion of pyhton strings: 1. case-sensitive conversion of all characters in a string (only valid for letters). There are two methods: print 'just to test it '. upper () # All letters are converted into uppercase letters and written as just to test it print 'just to test it '. lower () # convert all letters to lowercase just TO test it 2. Convert the characters in the string (only valid for letters) into uppercase and lowercase: print 'just to TEST it '. capitalize () # converts the initial character of a string to uppercase, and the rest TO lowercase Just to test it print 'just to test it '. title () # The first letter of all words in the string is converted To uppercase, and the rest are converted TO lowercase Just To Test It. 2. The function used TO determine the case of the string is print 'just To TEST it '. isupper () True print 'just to test it '. islower () False print 'just to test it '. istitle () False

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.