Sep-03-2022, 10:53 AM
Hi
I have following code which searches for index position of matching string without having to match everything:
I thought about:
Thanks
Matt
I have following code which searches for index position of matching string without having to match everything:
sheet_num = [] for x in range(len(list_of_sheets)): if sheet_match in list_of_sheets[x]: sheet_num.append(x)I'm looking for a better way to accomplish this as my code is filled with many occurrences of this type of for loop appending to an empty list.
I thought about:
list(map(lambda x: sheet_match in x, list_of_sheets))But it returns a list of boolean values instead of the index position of the match. I'm sure its simple but I'm not so competent in Python to know it.
Thanks
Matt