Other ways to play strings

Seeking character length used len ()
Insert picture description here
Note: space character is a
request string maximum value (ASCII value of the character), using the max () , the minimum value using the min ()
Insert picture description here
See the ASCII value of the character , using the ord ()
Insert picture description here
To check whether the character is in the string , use in/not in
Insert picture description here
r: the original string. In the input path such as C:\news, the program may interpret it as an escape character. Add r before it to avoid errors.
Insert picture description here
View the data Type , use the type
Insert picture description here
string to split , use split() (the split characters are in parentheses)
Insert picture description here

To connect strings , use join()

Insert picture description here

To remove spaces or characters , use strip() to
remove spaces or characters on the left, use lstrip() to
remove spaces or characters on the right, use rstrip()
Insert picture description here

Capitalize all characters , use lower()
to lowercase all characters , and use upper()
Insert picture description here to determine case
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51864831/article/details/109391552