Building a python environment with poetry on mac os

Pip is a major method of installing python libraries. poetry is a more advanced version control tool for development environments. It seems to have official support for pyenv integration. I’ll write down how to install it on mac os and what I got stuck. Advantages of poetry Can organize library dependencies. There are some unexpected side effects depending on the version of the library. Trying to recreate the environment can cause errors with library versions and installation order. [Read More]

pythonに引数をとらせるArgparseの例

サンプルプログラム 以下公式サイトより引用 import argparse parser.add_argument("square", type=int, help="display a square of a given number") parser.add_argument("-v", "--verbose", action="store_true", help="increase output verbosity") args = parser.parse_args() answer = args.square**2 解説 parser.add_argument("square", type=int, help="display a square of a given number") 引数の名前がsquare 型を指定 [Read More]