I would like to iterate over request.files content and check if a key exists , however the key value is : "item_i" , so the key could be one or more : "item_0" , "item_1" "item_2" ... i would like to create a loop and retrive the keys if the keys startwith item_ save them in a list and at the end return the list lenght if it'szero returns an erro no key "item_"
code looks like :
result = []
for (int i = 0; i < request.files.count; i++):
key = Request.Files.GetKey(i)
if key.startswith("item_"):
result.append(key)
if len(result) == 0:
return f" No {item_}key exists !", HTTPStatus.BAD_REQUEST,
PS : i'm using flask , not sure that request.files.count works but the most important is to iterate over all the request.files items many thanks .