蚁族的乐土

关注

python字符串的判重

蚁族的乐土

关注

阅读 52

2023-08-31

#2.已知字符串st="dffsda123dfsadfa",判断每个单词出现的次数
st="dffsda123dfsadfa"
list1=[]
list2=[]
for i in st:
    list1.append(i)
    if i not in list2:
        list2.append(i)
for i in list2:
    print(i,"出现的次数为",list1.count(i),"次")

运行结果:

python字符串的判重_判重

相关推荐

青乌

python对字符串内容去重

青乌 179 0 0

兵部尚输

OpenJudge NOI 1.7 17:字符串判等

兵部尚输 102 0 0

芭芭蘑菇

Python 字符串 ~ 字符串函数

芭芭蘑菇 197 0 0

Separes

python字符串:字符串判断方法

Separes 81 0 0

得一道人

python删除字符串指定字符串

得一道人 132 0 0

沪钢木子

python字符串:字符串的查找和替换

沪钢木子 129 0 0

佛贝鲁先生

python字符串:字符串文本对齐

佛贝鲁先生 100 0 0

年夜雪

python字符串:字符串的拆分和拼接

年夜雪 217 0 0

芒果六斤半

Python 字符串

芒果六斤半 51 0 0

small_Sun

python字符串

small_Sun 235 0 0

精彩评论(0)

0 0 举报