随笔分类 - python随笔
摘要:import numpy as np a1 = np.array([1,2,3,4],dtype=np.complex128) print(a1) print("数据类型",type(a1)) #打印数组数据类型 print("数组元素数据类型:",a1.dtype) #打印数组元素数据类型 pri
阅读全文
摘要:word='202110300415' print(word[2:4]) print输出结果为:21 理解: 如果你想取“202110300415”中的“3004” 那么“3”前面有6个数字 “3004”是一个4位数 因此你应该编写代码: print(word[6:10]) word[6:10]中的
阅读全文
摘要:#取商 a=56 b=5 c=a/b print(c) #显示c=11 #取余 a=56 b=5 c=a%b print(c) #显示c=1 #计算次幂 a=3 b=4 c=a**b print(c) #显示c=81
阅读全文
摘要:下划线分隔(变量命名): my_name = 'yunchuwei' my_age = 18 my_gender = 'male' 小驼峰(函数命名): def homeAddress(): print('somewhere in jiangxi') 大驼峰(类命名): class FoodType
阅读全文