题目:
字符串 s=‘Life is short You need pyhon’ 统计这个字符串中每个单词的字母数量。
代码:
方法一:
# 字符串 s='Life is short You need pyhon' 统计这个字符串中每个单词的字母数量。
l=[]
str='Life is short You need pyhon'
for i in str:
if i!=' ':
l.append(i
题目:
字符串 s=‘Life is short You need pyhon’ 统计这个字符串中每个单词的字母数量。
代码:
方法一:
# 字符串 s='Life is short You need pyhon' 统计这个字符串中每个单词的字母数量。
l=[]
str='Life is short You need pyhon'
for i in str:
if i!=' ':
l.append(i