请尝试以下代码:
words = ['AA', 'AB', 'AB']
words_num = [[w, 0] for w in words]
# output: [['AA', 0], ['AB', 0], ['BB', 0]]
但是,如果我理解正确,为了解决你的主要问题,这可能就足够了:
from collections import Counter
words = ['AA', 'AB', 'BB', 'AA']
counts = Counter(words)
# output: Counter({'AA': 2, 'AB': 1, 'BB': 1})