美文网首页ITS·黑客
python方法(method)

python方法(method)

作者: JEZAU | 来源:发表于2017-04-07 00:02 被阅读0次

a.reverse() 只可以把list倒过来
a.lower() 将字符串中的大写字母变成小写字母
a.upper() 将字符串中的小写字母变成大写字母
remove() set中删除
add() set中加入元素
insert() list中插入元素
append() 在list末尾插入 append 不可以用于NoneType
pop() 删除list 或者dict中元素
str.capitalize()返回的字符串只有它的第一个字符大写的副本
s.strip(rm) 删除s字符串中开头、结尾处,位于 rm删除序列的字符
s.lstrip(rm) 删除s字符串中开头处,位于 rm删除序列的字符
s.rstrip(rm) 删除s字符串中结尾处,位于 rm删除序列的字符
rm为空则为空格

相关文章

网友评论

    本文标题:python方法(method)

    本文链接:https://www.haomeiwen.com/subject/rzscattx.html