python類型經常使用整理

 

# 1、數字
# int(..)
# 2、字符串
# replace  find  join  strip  startswith  split  upper  lower  format
# tempalte = "i am {name}, age : {age}"
# # v = tempalte.format(name='alex',age=19)
# v = tempalte.format(**{"name": 'alex','age': 19})
# print(v)
# 3、列表
# append、extend、insert
# 索引、切片、循環
# 4、元組
# 忽略
# 索引、切片、循環         以及元素不能被修改
# 5、字典
# get/update/keys/values/items
# for,索引

# dic = {
#     "k1": 'v1'
# }

# v = "k1" in dic
# print(v)

# v = "v1" in dic.values()
# print(v)
# 6、布爾值
# 0 1
# bool(...)
# None ""  () []  {} 0 ==> False
相關文章
相關標籤/搜索