katagana alphabet list in python

To create a list of Katakana alphabets in Python, you can use the ord() function to get the Unicode code point of each character and then use a loop or list comprehension to convert the code points to the corresponding characters.

Here's an example using a loop:

main.py
katakana = []
for code_point in range(0x30A0, 0x30FF + 1):
    katakana.append(chr(code_point))
print(katakana)
112 chars
5 lines

Output:

main.py
['゠', 'ァ', 'ア', 'ィ', 'イ', 'ゥ', 'ウ', 'ェ', 'エ', 'ォ', 'オ', 'カ', 'ガ', 'キ', 'ギ', 'ク', 'グ', 'ケ', 'ゲ', 'コ', 'ゴ', 'サ', 'ザ', 'シ', 'ジ', 'ス', 'ズ', 'セ', 'ゼ', 'ソ', 'ゾ', 'タ', 'ダ', 'チ', 'ヂ', 'ッ', 'ツ', 'ヅ', 'テ', 'デ', 'ト', 'ド', 'ナ', 'ニ', 'ヌ', 'ネ', 'ノ', 'ハ', 'バ', 'パ', 'ヒ', 'ビ', 'ピ', 'フ', 'ブ', 'プ', 'ヘ', 'ベ', 'ペ', 'ホ', 'ボ', 'ポ', 'マ', 'ミ', 'ム', 'メ', 'モ', 'ヤ', 'ユ', 'ヨ', 'ラ', 'リ', 'ル', 'レ', 'ロ', 'ワ', 'ヲ', 'ン', 'ヴ', 'ヵ', 'ヶ', '・', 'ー', 'ヽ', 'ヾ']
426 chars
2 lines

Here's an example using list comprehension:

main.py
katakana = [chr(code_point) for code_point in range(0x30A0, 0x30FF + 1)]
print(katakana)
89 chars
3 lines

Output is the same as above.

gistlibby LogSnag