首页 > 为什么argparse输入变成数组

为什么argparse输入变成数组

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


因为用了 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 的说明

【热门文章】
【热门文章】