内容回顾

一、运算符

  in

  "hello" in  "ashdjfhajkldad ajkdadh fla"

  "li" in ['li','ok']

二、基本的数据类型

  int 

    n1=123    #根据int类,创建了一个对象

    n2=int(123)  #根据int类,创建了一个对象

  a、特有的功能在

      int类

        功能1

        功能2

        功能3

        _init_

  b、int内部优化

  n1=123

  n2=n1

  

  n1=123

  n2=123

  ===============两份内存===============

  #python内容优化:

    -5~257

      n1=123

      n2=123

    else:

      n1=123

      n2=123

  #查看内存地址:id(变量名)

  #查看字符串、数组长度:len(字符串、数组)

  c、长度限制

    用int,超出了范围

    32位的机器      -2**31~2**31-1

    64位的机器      -2**63~2**63-1

   long

    a、长度限制

    

  str

  a、创建方式

    s1="alex"

    s1=str('alex')

    #无参数,创建空字符串

    #一个参数,创建普通字符串

    #两个参数,int(字节,编码)

    str()

      str类 _init_

  #两端去空格

  #s1.strip()

  b、特有的功能

    #以。。。开头

    #s1.startwith()

  

    #找子序列 "12","h"

    #s1.find()

    #将字符串中的某子序列替换成指定的值

    #s1.replace()

  

    #变大写

    s1.upper()

  

    #是什么吗

    #s1.isalpha()

  c、公共功能

    索引、

    切片

  list

    list()

      list类 _init_

三、其他

猜你喜欢

转载自www.cnblogs.com/zyqy/p/9245523.html