6
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

python 文字列変換【カタカナ⇔ひらがな】

jaconvを使った変換

jaconv (Japanese Converter) はひらがな・カタカナ・全角・半角の文字種変換ができます
※全角⇔半角の変換に関しては"mojimoji"の方が高速処理できます

カタカナ⇔ひらがな

change.py
import jaconv

word1 = "リンゴ"
change_word1 = jaconv.kata2hira(word1)
# ⇒りんご

word2 = "ぷりん"
change_word2 = jaconv.hira2kata(word2)
# ⇒プリン
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
6
Help us understand the problem. What are the problem?