It is a List Comprehension
Edit: Included the tuple that I missed that @deanhystad reiterates below
items = [ # Here I need help I don't know what is going on here. We have some list(items = []) (o.value,) # What is this? for i in book.active.iter_rows() # Here we are going over sheet for o in i # Here we are goking over lines if o.value and isinstance(o.value, str) # Here we compare our words with cell data and search_string1.lower() in o.value.lower() and search_string2.lower() in o.value.lower() # Could anybody describe this block of code in more detail ] # Or write this piece of code for newbie languageThis is the equivalent as normal for loops
items = [] for i in book.active.iter_rows(): for o in i: if ( o.value and isinstance(o.value, str) and search_string1.lower() in o.value.lower() and search_string2.lower() in o.value.lower() ): items.append((o.value,))
Edit: Included the tuple that I missed that @deanhystad reiterates below