zoukankan      html  css  js  c++  java
  • 六种数据类型

    六大数据类型:

      数值类型:int, float, bool, complex    number不可变

      序列类型: list (可变),  str, tuple   

      非序列类型:set(可变), dict(可变)

    变量三属性:

    a =1  
    
      值,地址id,类型type
    list插值3种
    list1 + list2
    li = [1,2,3]
    li.append('hello')  [1, 2, 'hello']
    li.extend('hello')  [1,2,3,'h','e','l','l','o']

    字符串方法

    S='afafa23rw'
    
    S.endswith(suffix[, start[, end]]) -> bool
    S.startswith(prefix[, start[, end]]) -> bool
    S.isalpha() -> bool  字母
    S.isdigit() -> bool  数字
    S.islower() -> bool  小写

    s ='hello python !'
    s.split()    ->['hello','python','!']

    字符串拼接

    '{x}{x}{x}'.format(x='s',y='t',z='r')    ->  'sss'

    %s str() 展示给人看的 str('a')
    %r repr() 展示给计算机看的 repr('a')
    %d digit
    %f float()

  • 相关阅读:
    LaTeX插入数学公式
    清除浮动的4种方式
    水平居中与垂直居中
    如何实现两三栏布局
    BFC
    flex弹性盒子
    盒模型
    Git
    jQuery设置disabled属性与移除disabled属性
    TP---where多条件查询
  • 原文地址:https://www.cnblogs.com/tangpg/p/8668411.html
Copyright © 2011-2022 走看看