Home  >  Q&A  >  body text

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

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

PHPzPHPz2647 days ago623

reply all(1)I'll reply

  • 黄舟

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

    因为用了 nargs

    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 的说明

    reply
    0
  • Cancelreply