购买主题
感觉有锅
w =
w = ', text) if len(item)>5]
w =
{:10_249:}{:10_247:}{:10_247:}
{:10_250:}{:10_250:}{:10_250:}{:10_250:}{:10_250:}{:10_250:}{:10_250:}
w=
小师妹我爱你
查看解析
本帖最后由 魔界风信子 于 2021-11-18 09:56 编辑
学习
w =
text = """
Once upon a time there were three little sisters,
the Dormouse began in a great hurry;
and their names were Elsie, Lacie, and Tillie;
and they lived at the bottom of a well.
‘What did they live on?’ said Alice,
who always took a great interest in questions
of eating and drinking."""
w = list(word for word in text.replace(","," ").replace(";"," ").replace("."," ").replace("?"," ").replace("‘"," ").replace("’"," ").replace("\n"," ").split(" ")if len(word)>5)
print(w)
.
text = """
Once upon a time there were three little sisters,
the Dormouse began in a great hurry;
and their names were Elsie, Lacie, and Tillie;
and they lived at the bottom of a well.
‘What did they live on?’ said Alice,
who always took a great interest in questions
of eating and drinking."""
w =
print(w)
w =
先把他化作一个列表:text.strip().replace('\n','').split(' ')
然后遍历一下,相同的单词每次加1,但是一行代码怎么搞定,还有点费劲。
学习学习
1
1
w =
w =
已有 23 人购买 本主题需向作者支付 5 鱼币 才能浏览