АМ
import os.path
if os.path.exists(file_path): ....
else: ....
Size: a a a
АМ
import os.path
if os.path.exists(file_path): ....
else: ....
R3
R3
А
>>> from itertools import cycleвернуться обратно к единице.
>>> c = cycle([1,2,3])
>>> next(c)
1
>>> next(c)
2
b
try:
with open(filedata, 'r') as file:
model_list = file.readlines()
except FileNotFoundError:
with open(filedata, 'w') as file:
model_list = file.readlines()
R3
БГ
try:
with open(filedata, 'r') as file:
model_list = file.readlines()
except FileNotFoundError:
with open(filedata, 'w') as file:
model_list = file.readlines()
ㅤ
БГ
try:
#открываем и читаем
except FileNotFound:
#создаём
БГ
АМ
БГ
АМ
b
KV
>>> from itertools import cycleвернуться обратно к единице.
>>> c = cycle([1,2,3])
>>> next(c)
1
>>> next(c)
2
b
А
АМ
R3
b