码迷,mamicode.com
首页 > 其他好文 > 详细

数据类型整理

时间:2018-07-15 21:24:20      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:整理   items   name   ace   字符   one   find   print   python   

######################整理#############################


数字
    int(..)

  

字符串
    replace/find/join/strip/startswith/split/upper/lower/format
    tempalete = "i am {name},age:{age}"
    # v = tempalets.pormat(name=‘alex‘,age=‘19‘)
    v = tempalete.format(**{"name":‘alex‘,‘age‘:19})
    print(v)

  

列表
    append/extend/insert
    索引/切片/循环

  

元祖
    忽略
    索引 / 切片 / 循环    一级元素不能修改

  

字典
    get/update/keys/values/items
    for/索引
    in 操作
    dic = {‘k1‘:‘v1‘,‘k2‘:‘v2‘}
    v = ‘v2‘ in dic.values()
    print(v)

  

布尔,bool     
 None ‘‘ () {} []  0  布尔值判断时都是False

  

# 判断语句的和in not in 和比较的结果都是布尔值























数据类型整理

标签:整理   items   name   ace   字符   one   find   print   python   

原文地址:https://www.cnblogs.com/wenxingxu/p/9314455.html

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