Say I want to parse a text file that has lines:
sampleMethod
sampleParameter
sampleParameter2
where sampleMethod is a string of a method and sample parameters can be any type values.
I know I can use getattr to dynamically call something givn we know the module and method name:
output = getattr(componentName, sampleMethod)(sampleParameter)
but how can I do this if there are multiple parameters we discover dynamically?
So for example if the text file has:
sampleMethod
sampleParameter
sampleParameter2
sampleParameter3
how can we do someting like this dynamically?
output = getattr(componentName, sampleMethod)(sampleParameter, sampleParameter2, sampleParameter3)