学习:python len()函数

len() 获取序列长度

lista=[1,2,22,2222,3333,4444,4444]
tuplea=(1,2,22,2222,3333,4444,4444)
dicta={"name":"pan","age":"18"}
seta={21,24,25,26,27,28}

length=len(lista)
print(length)

#获取字符串长度的方法
s1="hello world!"
print(len(s1))
print(s1[-2])

 

posted @ 2022-07-07 01:33  测试小潘  阅读(162)  评论(0)    收藏  举报