搜尋

首頁  >  問答  >  主體

python - 为什么argparse输入变成数组

输入10但是获得的是一个数组[10],这个是什么问题呢?

PHPzPHPz2884 天前768

全部回覆(1)我來回復

  • 黄舟

    黄舟2017-04-17 17:11:30

    因為用了 nargsnargs

    Note that nargs=1

    Note that nargs=1 produces a list of one item. This is different from the default, in which the item is produced by itself.

    argparse 文件關於 nargs 的說明🎜

    回覆
    0
  • 取消回覆