Home > OS >  Find all the Korean Carachters in a word in Python
Find all the Korean Carachters in a word in Python

Time:12-29

I'm trying to get a list of every character of a korean syllable of input, such as:

example = '만들다'

But when I try it with:

print([*example[-2]])

I get

['들']

While I'm trying to get as output something like:

['ㄷ', 'ㅡ', 'ㄹ']

CodePudding user response:

You can use Jamo module to do it

from jamo import h2j, j2hcj
example = '만들다'
char = example[-2]
print([*j2hcj(h2j(char))])

the jamo library provides a easy interface to Hangul decomposition. You can also read the documentation

  • Related