All pockets as a tuple in Python's search method
It is possible to obtain all pockets as a tuple. This is done using the groups method.
Let's see how to work with it. Let's say we have a string:
pythontxt = '123 456 789'
Let's find the first row that matches the numbers. And then output all the pockets from it as a tuple:
pythonres = re.search('(\d)(\d)(\d)', txt)
print(res.groups()) # ('1', '2', '3')
Задание 1
Given a string containing a domain:
pythontxt = 'http://domain.ru'
Get a tuple consisting of the protocol, domain name, and domain zone.