Python string Learning Three

Source: Internet
Author: User

1, Ord (), Convert the character to its corresponding ASCII code

Chr () converts the ASCII code to the corresponding character

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M00/8F/2D/wKiom1jWCurAUuBIAAAJq4areFQ487.png-wh_500x0-wm_ 3-wmp_4-s_2467882137.png "title=" qq picture 20170325141450.png "alt=" wkiom1jwcurauubiaaajq4arefq487.png-wh_50 "/>


Example: Converting a string of binary numbers to an equivalent decimal number

650) this.width=650; "src=" https://s5.51cto.com/wyfs02/M00/8F/2B/wKioL1jWD2CgIA68AAAD6EtLpyo733.png-wh_500x0-wm_ 3-wmp_4-s_204915850.png "style=" float:none; "title=" qq picture 20170325143212.png "alt=" Wkiol1jwd2cgia68aaad6etlpyo733.png-wh_50 "/>

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M01/8F/2D/wKiom1jWD2GT_LpjAAAFVHYOWF8505.png-wh_500x0-wm_ 3-wmp_4-s_878898146.png "style=" float:none; "title=" qq picture 20170325143220.png "alt=" Wkiom1jwd2gt_ Lpjaaafvhyowf8505.png-wh_50 "/>


2, string modification:

The string has an immutable property that cannot be changed after it is created, and if you want to modify it, you can create a new string and assign it with the same variable name

650) this.width=650; "src=" https://s2.51cto.com/wyfs02/M02/8F/2D/wKiom1jWENewwgbiAAAPFJl6Ae8673.png-wh_500x0-wm_ 3-wmp_4-s_399973224.png "title=" qq picture 20170325144010.png "alt=" wkiom1jwenewwgbiaaapfjl6ae8673.png-wh_50 "/>


You can also use the Replace () function to Modify:

650) this.width=650; "src=" https://s1.51cto.com/wyfs02/M02/8F/2B/wKioL1jWEh7RKJMJAAAMMe-BW9c213.png-wh_500x0-wm_ 3-wmp_4-s_2868798155.png "title=" qq picture 20170325144536.png "alt=" wkiol1jweh7rkjmjaaamme-bw9c213.png-wh_50 "/>



This article is from "a growing small tree" blog, please be sure to keep this source http://growing2015.blog.51cto.com/12006344/1910310

Python string Learning Three

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.