You are missing a closing parenthesis:
if imagesNamesList==["None" for x in range(len(listOfImages))]:
# here--^
However, you could write this code better (cleaner and more efficiently) like so:
if imagesNamesList == ["None"]*len(listOfImages):
Or, if your lists are huge, you can do as @mgilson noted:
if all(x == "None" for x in imagesNamesList) and len(imagesNamesList) == len(listOfImages):
Though this method requires more syntax, it is actually more efficient because of the short-circuiting property of all
(it will stop evaluating at the first x == "None"
that comes back False
, if any).
2
solved if imagesNamesList==[“None” for x in range(len(listOfImages)]: [closed]