⊗pyPmREMFmP 65 of 128 menu

Pockets in Python's fullmatch method

The fullmatch method can also be used to split the results into pockets.

Let's look at an example. Let's say we have a line:

txt = '123 456 789'

Let's distribute all her numbers among her pockets:

res = re.fullmatch('(\d+)\s(\d+)\s(\d+)', txt) print(res[1]) # '123' print(res[2]) # '456' print(res[3]) # '789'

Given a string:

txt = '2025-12-31'

Divide it into three pockets.

enru