Perhaps not the shortest, but a nice solution: from string import maketrans text = open("lorem.txt").read() intab = "\n.," outtab = " " trantab = maketrans(intab, outtab) text = text.translate(trantab); worte = text.split(" ") for w in worte: z = text.count(w)...