#把英字母都存入字典內,並對應其出現的次數 str = 'tomorrow' #方法1:for s in str....(a[鍵] = 值) a = dict() for s in str: a[s] = str.count(s) print(a) #方法2:{鍵:值 for s in ttr}} #b = dict() b = {s:str.count(s) for s in str} print(b)