【发布时间】:2015-07-23 02:45:16
【问题描述】:
这是我的句子:
s = "& how are you then? I am fine, % and i want to found some food #meat with vegetable# #tea# #cake# and #tea# so on."
我正在计算句子 s 中受 # # 约束的单词的频率。
我想要以下输出
[("meat with vegetable", 1)
("tea", 2)
("cake", 1)]
非常感谢您的帮助和时间!
【问题讨论】:
-
考虑我对你帖子的修改!
-
感谢您的精彩修改
-
您自己尝试过什么吗?这不是代码编写服务
-
['素肉', '茶', 'cake', 'tea'] Counter({'tea': 2, 'cake': 1, '素肉': 1} )
-
this 现在对应 'piglei's advice ,我得到以下结果,['meat with vegetables', 'tea', 'cake', 'tea'] Counter({'tea': 2, “蛋糕”:1,“蔬菜肉”:1})
标签: python list count frequency