Python Note

第一章——基础知识 1、模块的引入 1 2 3 4 5 6 7 8 9 10 11 12 #demo: # 随机数 #导入import 模块 import random a=random.randint(1,5) #a最终被赋值为1,2,3,4,5之间的随机一个数,左闭右闭 #这里包括1和5! 2、数据类型 1 2 3 4 5 6 7 8 9 10 11 #type() 获取信息 #例如 a='520.0' b=float(a) type(a)#输出<class 'str'> type(b)#输出<class 'float'> #函数isinstance(var,class) #对比前后类型 isinstance(10,int)#输出True 强制类型转换 ...

Oct 06, 2020 · 14 min · Chasing1020