python中几种数据类型常用的方法

'''
python几种数据类型常用方法:
列表
增加:append,insert,extend
删除:remove,pop,clear
修改:
查询:index,count

元组
查询:index,count
*:解包操作

集合
增加:add
删除:pop,clear,remove

字典
增加:字典['键'] = 值
删除:pop,popitem,clear
修改:update(dict)
查询:get,keys,items,values,setdefault:有对应的键则返回对应的值,没有则返回默认给定的值

字符串:
状态获取:islower,isupper,isdigit,isalpha,isalnum,istitle,startswith,endswith
状态抓换:lower,upper,swapcase,title(单词首字母大写),capitalize(字符串首字母大写)
格式转换:strip(去掉左右两边参数字符串中的字符),ljust,rjust,center,spilt
查询:index,find,count
'''

猜你喜欢

转载自www.cnblogs.com/ycg-blog/p/12178185.html