14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

言葉の単数形と複数形の変換

Last updated at Posted at 2017-07-03

inflectionが便利

install

pip install inflection

使い方

import inflection as i


print("pluralize", i.pluralize("dog"))
print("singularize", i.singularize("dogs"))

# pluralize dogs
# singularize dog

利用例

複数形になっているテーブル名からクラス名のようなものを作りたい場合に

print(i.camelize(i.singularize("cats")))
# Cat
14
13
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
14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?