python自学笔记--数据类型

字符串 str
"hello" "彳尔女子"
整数 int
1,2,3,.....
浮点数 float
6.0 114.514
布尔型 bool
true //真
false //假
空值 nonetype
none
对字符串求长度
s = "hello world"
#定义一个函数
print(len(s))
#求函数s的长度
通过索引获取单个字符
#索引是从0开始计算
s = "hello world"
#定义一个函数
print(len(s))
#求函数s的长度
print(s[0])
#通过索引求长度,和数组相关

你可能感兴趣的:(python自学笔记,python,笔记)