zoukankan      html  css  js  c++  java
  • Python数据类型-7

    
    

    什么数据类型。
    int 1,2,3用于计算。
    bool:True,False,用户判断。
    str:存储少量数据,进行操作
    'fjdsal' '二哥','`13243','fdshklj'
    '战三,李四,王二麻子。。。。'
    list:储存大量的数据。
    [1,2,3,'泰哥','12353234',[1,2,3]]
    元祖:只读。
    (1,2,3,'第三方',)
    dict:字典{'name':'云姐','age':16}
    字典{'云姐':[],'二哥':[200,200,200,。。。。。。]}
    集合:{1,2,34,'asdf'}
    3,int。

    4,bool。
    5,str。

    i = 100
    print(i.bit_length())
    '''
                      bit_length
    1     0000 0001       1
    2     0000 0010       2
    3     0000 0011       2
    '''
    #bool  True False
    
    #int ----> str
    i = 1
    s = str(i)
    #str ---> int
    s = '123'
    i = int(s)
    
    #int ----->bool  只要是0 ----》False  非0就是True
    i = 3
    b = bool(i)
    print(b)
    #bool----> int
    #True   1
    #False  0
    '''
    ps:
    while True:
        pass
    while 1: 效率高
        pass
    '''
    
    #str --->bool
    
    #s = "" -----> False
    #非空字符串都是True
    #s = "0" -----> True
    
    s
    if s:
        print('你输入的为空,请重新输入')
    else:
        pass
  • 相关阅读:
    nyoj163 Phone List
    hdu1251统计难题
    hdu1754 I Hate It
    nyoj123 士兵杀敌(四)
    poj3468 A Simple Problem with Integers
    zoj1610 Count the Colors
    nyoj144 小珂的苦恼
    nyoj93 汉诺塔(三)
    poj2182 Lost Cows
    ASP.NET2.0中的Callback机制
  • 原文地址:https://www.cnblogs.com/LXL616/p/10627596.html
Copyright © 2011-2022 走看看