Home >Backend Development >Python Tutorial >Learning records of python strings

Learning records of python strings

高洛峰
高洛峰Original
2017-03-26 17:43:291372browse

1, ord(), convert the characters into their corresponding ASCII codes

chr(), convert the ASCII codes into the corresponding Characters

Learning records of python strings

Example: Convert a binary number string to the equivalent decimal number

Learning records of python strings

2. String modification:

Strings are immutable and cannot be changed after they are created; if you want to modify them, you can create a new string and use the same Variable nameAssign a value to it

Learning records of python strings

##You can also use replace()

function to modify it:

Learning records of python strings

The above is the detailed content of Learning records of python strings. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn