- 博客(3)
- 收藏
- 关注
原创 python上课第三期-数据类型转换
#字符转换str(),int(),float() a=1 b=1.2 c=True print(str(c),type(str(c)))#True <class 'str'> s1='12' s2=True s3='hello' s4='2.2' s5=2.7 s6=23 print(int(s1), type(s1)) print(int(s2), type(int(s2))) #print(int(s3),type(int(s3)))报错,str转成int,字符串必须为整数字串 #prin.
2021-11-12 18:27:45 959
原创 python上课笔记第二期—数据类型
#整数类型int #浮点 #布尔 #字符串 # 整数类型int,正数负数0 n1 = 2 n2 = -3 n3 = 0 print(n1, type(n1)) print(n2, type(n2)) print(n3, type(n3)) #默认十进制 #二进制0b print('二进制', 0b111010) #8进制0o,16进制0x print(0o176) print(0x1ef) #浮点 a=3.14159 print(type(a)) n1=1.1 n2=2.2 n3=2.1 pri.
2021-11-08 10:38:15 94
原创 python上课笔记第一期-print输出
print(40) # 可以输出数字,表达式,字符串(‘’,“”,’‘’ ‘’‘) print("hellowed") print(3+1) # 将数据输出到文件:所指定盘存在,使用file=fp,其中fp是变量 fp = open('ni', 'a+') # a+文件不存在就创建,存在就继续追加 print('helloword',file=fp) # 用记事本打开 fp.close() # 关闭 # 不进行换行输出 print('hello', 'world', 'python') ..
2021-11-07 17:23:34 131
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人