So in java you can do something like this if you don’t know how many parameters you are going to get
private void testMethod(String... testStringArray){
}
How can I do something like this in python
as I can’t do something like this right?
def testMethod(...listA):
Are you talking about variable length argument lists? If so, take a look at
*args,**kwargs.See this Basic Guide and How to use *args and **kwargs in Python
Two short examples from [1]:
Using
*args:Results:
and using
**kwargs(keyword arguments):Results:
Quoting from this SO question What do *args and **kwargs mean?: