Find all the Korean Carachters in a word in Python

Question:

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:

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

Answers:

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

Answered By: Shounak Das
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.