Python-da match metodunda qebler

match metodu ile iwleyerken tapılmış alt sətri qeblere göre bölmek olar.

Tutaq ki, bizim bir sətrimiz var:

pythontxt = '12 34 56'

Gəlin rəqəmlerle birinci alt sətri tapaq və onu iki qebe bölək:

pythonres = re.match('(\d+)(\d+)', txt)

print(res[0]) # çap edecek '12'
print(res[1]) # çap edecek '1'
print(res[2]) # çap edecek '2'
Задание 1

Bir sətir verilib:

pythontxt = ' 1234'

Sətrin əvvəlinde yerləşən domeni tapın və onun adını birinci qebe, zonunu isə ikinci qebe qoyun.

Задание 2

Domen ehtiva edən bir sətir verilib:

pythontxt = 'sss domain.ru zzz'

Bu domeni tapın və onun adını birinci qebe, zonunu isə ikinci qebe qoyun.

Задание 3

Tarix ehtiva edən bir sətir verilib:

pythontxt = '31.12.2025'

Günü birinci qebe, ayı - ikinci, ili isə üçüncü qebe qoyun.