Python里,最常用的数据类型有三种——字符串(str)、整数(int)和浮点数(float)。
浮点数的英文名是float,与整数(int)和字符串(str)不同,浮点数没有简写。
ypeError:can only concatenate str (not "int") to str】(类型错误:只能将字符串与字符串拼接)
str代表字符串,全称为string,整数的英文简称为int,全称为integer。
int()函数的本质是将数据转换为整数。所以对于浮点数,int()函数会做取整处理。但是,同我们平时对小数四舍五入的处理方法不同,int()函数会直接抹零,直接输出整数部分。
2/2 为float 2//2 为int // 整除,保留整数
向二进制转换bin() 十进制int() 八进制oct() 十六进制hex()
bool True/False bool(空)//False bool("值")//True
print("C:\\fan\\ccc")
C:\fan\ccc
print(r' C:\\fan\\ccc') //不是普通字符串, 而是原始字符串
C:\\fan\\ccc