Answer the question
In order to leave comments, you need to log in
How to remake condition in python 3.10?
Good evening, there is a condition that works on python 3.9 version
for i in files_dict:
if 'FULL.zip'.lower() in i['key']:
time_create = i['value']
print(time_create)
if i['value'] < time_create:
print(i['value'])
Traceback (most recent call last):
File "F:\python proj\proj1\main.py", line 42, in <module>
if i['value'] < time_create:
NameError: name 'time_create' is not defined
Answer the question
In order to leave comments, you need to log in
It's not the python version, but the fact that you don't have the "full.zip" string in i['key'] for the first i. In this case, python 3.9 will give exactly the same error, since the first if will not work, and the second will call time_create.
But why this is so is a completely different question. Maybe different packages are installed on two versions of python. Maybe it's just that the files in files_dict end up in a slightly different order. I would advise to fix the algorithm as a whole, i.e. initialize time_create with some value before the loop.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question