I. STR type
The content of the "" "" "" "is a string.
Strings are immutable data types, and each operation returns a new string regardless of what you do
Index starting from 0, using [] can get to each character, can also be inverted (str[])
Slice
str[:]
Gu Tou regardless of the tail
No step can be cut from left to right
A negative length can be cut from right to left
Related Operations on strings
. Format {}. Format () {} can also put the index of a string
S.title () capitalize the first letter of each word
. Upper () (converted to uppercase)
. Lower (). Casefold (Convert to lowercase)
. Capitalize () (to capitalize the first letter of one character)
. Swapcase () (case-sensitive interchange)
. Remove () (delete)
. Stript () Remove the left and right spaces
. replace (old,new) replaces xxx with XXX (can also be added in the following times)
. Split () cut. Returns the list with how long the knife is going to lose.
. StartsWith () Decide whether to start with XXX
. EndsWith () Decide whether to end with
Len () string length (Python's built-in function)
. Find () finds the position where xxx appears in the string, finds only the first occurrence, and returns No 1
. Count () find the position where the character appears in the string
. Index () Look for the position where the xxx string appears, when the character does not present an error
Whether the. IsDigit () is made up of integers
Whether the. Isalpha () is composed of letters
Whether the. Isalnum () is made up of numbers and letters
Python string (str)