-
Notifications
You must be signed in to change notification settings - Fork 0
/
tst.py
48 lines (37 loc) · 921 Bytes
/
tst.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def tst():
x = 0
while True:
x += 1
print(x)
if x == 15:
return x
def tst1():
def ret_bool():
return False, False
if ret_bool():
print(True)
else:
print(False)
def tst3():
l = ['Apple', 'Banana', 'Berry', 'Cherry']
for i in l:
if i in ['Banana', 'Berry']:
l.remove(i)
print(l)
import re
import datetime
def tst4():
a1 = 'Луна / Deo mun (The Moon) / 202 3 / ДБ, СТ / WEB-DL (1080p)'
print('/' in a1)
a2 = 'Луна Deo mun (The Moon) 2023 ДБ, СТ'
removed_spaces = re.sub(r'\s+', ' ', a2)
b = [element.strip() for element in removed_spaces.split(' ')]
print(' '.join(b[:5]))
match = re.search(r'\d{4}', a1)
if match:
year = str(match.group())
else:
year = str(datetime.now().year)
print(year)
if __name__ == '__main__':
tst4()