码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2020-01-10 22:29:23      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:dex   upd   参数   color   apc   str   cas   append   大写   

‘‘‘
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
‘‘‘

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

标签:dex   upd   参数   color   apc   str   cas   append   大写   

原文地址:https://www.cnblogs.com/ycg-blog/p/12178185.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!