python - How to pass parameters to a module, the parameter is the function name of the module?
扔个三星炸死你
扔个三星炸死你 2017-06-12 09:26:33
0
1
948

I hope to execute multiple functions in the module by passing parameters.

For example: there are functions daifu, jiekuan, and tixian in the tb module
import tb
tb.daifu.save(os.path.join(args.savedir, xlname))

Directly write the module. The function name can be called. But if the value of the function name is passed, the type is wrong. It is not a function but a string.
I would like to ask how to use the function name of the parameter type as a function?

扔个三星炸死你
扔个三星炸死你

reply all(1)
世界只因有你
getattr(tb, 'daifu').save(os.path.join(args.savedir, xlname))

Is this so?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template