python笔记(常用方法)

Python
len() 方法返回对象(字符、列表、元组等)长度或项目个数。

range() 函数可创建一个整数列表,一般用在 for 循环中。

range(start, stop[, step])
start: 计数从 start 开始。默认是从 0 开始。例如range(5)等价于range(0, 5);
stop: 计数到 stop 结束,但不包括 stop。例如:range(0, 5) 是[0, 1, 2, 3, 4]没有5
step:步长,默认为1。例如:range(0, 5) 等价于 range(0, 5, 1)

str 转化为字符串类型

猜你喜欢

转载自blog.csdn.net/qq_41730186/article/details/88186557