我的python之路6(整理)

一、数字

int()

二、字符串

str

replace/find/join/strip/starswith/split/uper/lower/format

tempalte="i am {name},age:{age}"
v=tempalte.format(name="alex",age=19)
print(v)
v=tempalte.format(**{"name":'alex','age':19})
print(v)

输出

i am alex,age:19
i am alex,age:19

三、列表

append/extend/inert

索引、切片、循环

四、元祖

索引、切片、循环    一级元素不能被修改

五、字典

get/update/keys/values/items/for/索引

dic={
        "k1":'v1'
    }
v="k1" in dic
print(v)
vv="v1" in dic.values()
print(vv)

输出

True
True

六、布尔值   0 1

bool()

None ""  []  () {}  0==>False

原文地址:https://www.cnblogs.com/liushuizs/p/10233299.html