报错提示:
usage: gen_furby.py [-h] [-kind KIND] [-plot] [-dm DM [DM ...]]
[-snr SNR [SNR ...]] [-width WIDTH [WIDTH ...]] [-dmsmear]
[-scatter] [-v] [-D D]
Num
gen_furby.py: error: too few arguments
Process finished with exit code 2
没有提示具体是哪条语句错了,可能是因为下面这些语句:
if __name__ == '__main__':
a=argparse.ArgumentParser()
a.add_argument("Num", type=int, help="Number of furbies to generate")
a.add_argument("-kind", type=str, help="Kind of frequency structure wanted. Options:[slope, smooth_envelope, two_peaks, three_peaks, ASKAP]")
a.add_argument("-plot", action='store_true', help = "Plot the FRB instead of saving it?", default = False)
a.add_argument("-dm", nargs='+', type=float, help="DM or DM range endpoints", default = 1000.0)
a.add_argument("-snr", nargs='+', type=float, help="SNR or SNR range endpoints", default = 20.0)
a.add_argument("-width", nargs='+', type=float, help="Width or width range endpoints (in ms)", default = 2.0)
a.add_argument("-dmsmear", action='store_true', help = "Enable smearing within individual channels (def=False)", default=False)
a.add_argument("-scatter", action='store_true', help='Enable scattering (def = False)', default=False)
a.add_argument("-v", action='store_true', help="Verbose output", default = False)
a.add_argument("-D", type=str, help="Path to the database to which the furby should be added (def = ./)", default = "./")
args= a.parse_args()
main(args)
百度上说 parse_args()需要传一个参数?实在不懂怎么传
gen_furby.py是你的python主文件吗