#統計字符串中每個字符出現的次數 以The quick brown fox jumps over the lazy dog為例 message='The quick brown fox jumps over the lazy dog' count={} for character in message: count.setdefault(character,0) count[character]=count[character]+1 print(count)
參考:《Python編程快速上手--》
