python-len返回对象的长度

天子骄龙 / 2024-11-09 / 原文

 

返回字符串的字符数

str1="lm是中国人"
i=len(str1)
print(i)

 

 

返回元素个数

list01=[1,2,3,4,5]
i=len(list01)
print(i)