Is there an equivalent in Python to match.arg() as you have in R? Basically limiting the user the choice of inputs one can make for an input function parameter.
I know it is an old question, but I needed this and there is no answer. So, just for future need:
def match_arg(x, lst):
return [el for el in lst if x in el]
lst = ["gaussian", "epanechnikov", "rectangular", "triangular"]
print(match_arg("gauss", lst))
print(match_arg("pauss", lst))
Which yield:
['gaussian']
[]
Kr.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.