在Python 3(您似乎正在使用)中:
>>> sentence = "Hi my name is Bob">>> words = sentence.split()>>> average = sum(len(word) for word in words) / len(words)>>> average2.6
欢迎分享,转载请注明来源:内存溢出
在Python 3(您似乎正在使用)中:
>>> sentence = "Hi my name is Bob">>> words = sentence.split()>>> average = sum(len(word) for word in words) / len(words)>>> average2.6
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)