Pockets in Python's findall method
In the findall method, you can specify pockets to search for matches.
Let's say we have a line:
pythontxt = '12 43 56 ab'
Let's find all the pairs of numbers and put them into pockets:
pythonres = re.findall('(\d)(\d)', txt)
print(res)
Result of code execution:
python[('1', '2'), ('4', '3'), ('5', '6')]
Задание 1
The following line is given:
pythontxt = '12:37 15:48 17:59';
Find all the substrings with time in it and for each found one, distribute the hours and minutes among the pockets.
Задание 2
Given a string:
pythontxt = 'site.ru sss site.com zzz site.net';
Get domain names from this line by putting the domain name and its zone into different pockets.