摘要:
# from enum import Enum # 枚举 # class VIP(Enum): # YELLOW = 1 # YELLOW_ALIAS = 1 # 别名 # GREEN = 2 # BLACK = 3 # RED = 4 # print(VIP.GREEN) # VIP.GREEN8VIP.GREEN # print(VIP... 阅读全文
摘要:
import json # json反序列化 # json_str = '{"name":"qiyue","age":18}' # student = json.loads(json_str) # print(type(student)) # # print(student) # {'name': 'qiyue', 'age': 18} # print(student['... 阅读全文
摘要:
# 1.检查一串数字是否是电话号码 # 2.检查一个字符串是否符合email # 3.把一个文本里指定的单词替换为另一个单词 import re # a = 'C|C++|Java|C#|Python|Javascript' # print(a.index('Python') > -1) # True # print('Python' in a) # True # r=r... 阅读全文
摘要:
# 函数 # 1.功能性 # 2.隐藏细节 # 3.避免编写重复代码 # 4. # print() # round() a = 1.12386 # 保留3位小数 result=round(a,3) print(result) # 定义函数 # def funcname(paramter_list) # pass # 1.参数列表可以没有 # 2.return value none... 阅读全文