01_python_(python语言_数据类型详解).docx

bool=False; python 数据类型详解 内容大纲 1、字符串 2、布尔类型 3、整数 4、浮点数 5、数字 6、列表 7、元组 8、字典 9、日期 1、字符串 1.1、如何在 Python 中使用字符串 a、使用单引号() 用单引号括起来表示字符串,例如: str=this is string; print str; b、使用双引号() 双引号中的字符串与单引号中的字符串用法完全相同,例如: str=this is string; print str; c、使用三引号() 利用三引号,表示多行的字符串,可以在三引号中自由的使用单引号和双引号,例如: str=this is string this is pythod string this is string print str; 2、布尔类型 print bool; bool=True; print bool; 3、数字类型 3.1、基本使用 整数 int=20; print int; 浮点数 float=2.3; print float; 3.2 、删除数字对象引用,例如: a=1; b=2; c=3; del a; del b, c; #print a; #删除 a 变量后,再调用 a 变量会报错 3.3、数字类型转换 int int(x [,base]) 将 x 转换为一个整数 float(x ) 将 x 转

文档评论(0)

1亿VIP精品文档

相关文档