-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask4.py
More file actions
28 lines (24 loc) · 836 Bytes
/
task4.py
File metadata and controls
28 lines (24 loc) · 836 Bytes
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
import os
def get_next(class_name: str) -> str:
"""
Возвращает относительный путь для объекта класса
Данная функция возвращает относительрный путь для объекта класса, переданного
в функцию
Parameters
----------
class_name : str
Имя класса
Returns
-------
str
Относительный путь к объекту
"""
path = os.path.join('dataset', class_name)
class_names = os.listdir(path)
class_names.append(None)
for i in range(len(class_names)):
if class_names[i] is not None:
yield os.path.join(path, class_names[i])
elif class_names[i] is None:
yield None
print(*get_next('polarbear'))