1
1

【Python】カタカナやひらがなをそれぞれに変更する方法

Last updated at Posted at 2024-02-07

◆問題
カタカナやひらがなをそれぞれに変更する方法が分からなかった。

◆対処法
「jaconv」を使用すればできた。

kana_hira.py
import jaconv

word1 = "ヤサイ"
change_word_hira = jaconv.kata2hira(word1)
print(change_word_hira)

word2 = "らーめん"
change_word_kana = jaconv.hira2kata(word2)
print(change_word_kana)

# 実行結果
やさい
ラーメン

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1