Skip to main content
 Web开发网 » 编程语言 » Python语言

len(numbers) 是什么函数 python知识!

2021年11月28日7660百度已收录

numbers = raw_input("输入几个数字,用逗号分隔:").split(",") #提示并输入字符串后,把字符串用逗号分割成 字符串数组。

print numbers #打印字符串数组

x = 0 #计数变量

while x < len(numbers): #当计数变量小于字符串数组长度,len是求长度的函数。即从0到len-1变化

print numbers[x] #逐行打印每个字符串

x = x + 1 #计数器增一

评论列表暂无评论
发表评论
微信