python 基础数据类型

数字int:1、2、3、4、5。

+ - * / **

  % 取余数

  ps:type(数字或'字符串')

  字符串转化成数字:int(str) 条件:str必须是数字组成的。
        数字转化成字符串:str(int) 

print(100,type(100))
print('100',type('100'))

 

字符串:str python中,凡是引号 '' 引起来的都是字符串,

  可相加,字符串的连接

  可相乘,str* int

a = '你好'
b = '小明'
print(a + b)
print(a*5 + b*2)

bool:布尔值,True False

 

posted @ 2020-05-18 16:52  烟斗和沙漏  阅读(114)  评论(0编辑  收藏  举报