정규 표현식(`re` 모듈)을 사용하여 특정 문자의 빈도를 계산할 수 있어요.
import re
text = "hello world"
char = 'o'
# 특정 문자의 빈도 계산
frequency = len(re.findall(char, text))
print(f"The character '{char}' appears {frequency} times in the text.")
# 출력: The character 'o' appears 2 times in the text.