Slice
Str[start:end:step]
Start: Starting from xxx (startswith)
End: Cut to XXX (EndsWith) not included
. Capitalize () #首字母大写
. Title () #标题, capitalize the first letter of each word (special characters, Chinese is also considered special characters here)
. Upper () #转换成大写字母
. Lower () #全部成小写
. Swapcase () #大小写转换
. Center (value) is elongated to 10 characters, filled by *
. Strip () #去掉左右两边空格
. Lstrip () #去掉左边空格
. Rstrip () #去掉右边空格
. replace () # replacement
. Split () #切割
. Count () #数数
. Find () #查找
. Index () #索引位置
. StartsWith () #是否以什么开头
. EndsWith () #是否以什么结尾
. Isalnum () #是否由数字和字母组成
. Isdgit () #是否以数字开头
. IsNumeric () #是否全是数字
. Isalpha () #是否由字母组成
Len () #判断字符串长度
List
. Append () # Append
. Insert () #插入
. Extend () #扩展
The list also has slices
. Pop () #弹出最后一个, or specify content
. Remove () #删除
The. Clear () #清空列表
Del #切片删除 del is a keyword
The. Sort () #升序
. Reverse () #翻转 (or descending)
Meta-group
Range can help us get to a set of data that can be obtained through a For loop,
Add: dic[' key ']= ' value ' (existing on modification, not present is new addition)
Dic.setdefault (' key ')
. SetDefault (' key ', ' value ') #新增
. SetDefault (' key ', ' value ') #存在不执行任何操作
. Popitem () #随机删除
The. Get () #查询
". Join (LST) #把列表变成字符串, concatenate the list with the preceding string, return the string
R Read-only mode
W Write-only mode
A Append write mode
r+ read/write mode (emphasis)
w+ Read-write mode (not commonly used)
A + append read/write mode (not commonly used)
Strip (except for removing spaces. You can also wrap)
Python in front of a few words meaning