I want to use a loop to select values with expression in a layer. The values contain the letters OS and a number (example: "OS1","OS2"). I want to use the loop to increase the number to use my processing script on the features separately. How do I use the selectbyexpression() in the right way to increase the number in a loop?
i = 1
OSnumber = str(i)
OSname = 'OS'+OSnumber
OS_trace = Map+'OS_tracés.shp'
layer = iface.activeLayer()
layer.selectByExpression("attributename = 'Osname'")