統計字符串裏每一個字符的個數

統計字符串裏每一個字符的個數 方法一: str = "hello world" from collections import Counter print(Counter(str)) 方法二: str = "hello world" new_list=[] # 字符串變列表 mylist = str.split() # 列表變字符串 mystr = "".join(mylist) print(
相關文章
相關標籤/搜索