Python Learning--string

Source: Internet
Author: User

1\string is immutable, which means you can ' t change an existing string.

>>>greeting = ' Hello world! '

>>>greeting[0] = ' J '

Typeerror:object does not support item assignment

2\the World in was a Boolean operator that takes the strings and returns True if the first appears as a substring In the second. For example, the following function prints all the letters from Word1 to also appear in Word2:

>>>def In_both (Word1, Word2):

>>> for Word1:

>>> if letter in Word2:

>>> Print Letter

3\the relational operators work on strings.

All the uppercase letters come before all the lowercase letters

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.