python programming skills

The ASCII code is converted into a string and traverse:

for c in map(ord,raw_input()):

The ASCII code is converted into a character string and stored in list

L = [ord(i)-ord('a') for i in input()]

Dictionary, if key exists otherwise create value + 1 (key, value = 0):

mp[d][sum] = mp[d].get(d,0) + 1

python Counter () counter (similar Multiset):

For absence key, the default value of the count is 0

from collections import Counter

Usage: https: //docs.python.org/3/library/collections.html#collections.Counter

enumerate, traversing element is a [index, value] List

for i in enumerate(s)

 

Guess you like

Origin www.cnblogs.com/mcflurry/p/4448003.html