Scala has the apply() function.
I am new to Python and I am wondering how should I write the following one-liner:
(part_a, part_b) = (lambda x: re.search(r"(\w+)_(\d+)", x).groups())(input_string) I would feel better with something like:
(part_a, part_b) = input_string.apply(lambda x: re.search(r"(\w+)_(\d+)", x).groups()) Am I wrong from a FF viewpoint? Is there such construction in Python?
Edit: I know about the poorly picked snippet.
part_a, part_b = apply(lambda ...: ..., input_string)worked.applyfunction since the beginning too, but sinceapply(fn, args, kwargs) == fn(*args, **kwargs)there is little use for it anymore..functools.partial()?re.search(r"(\w+)_(\d+)", input_string).groups()?