I am selecting a river by expression. There are more than two rivers with the same name. So, I am thinking of using HUC. I found the following site about the expression: Selecting features using an expression with PyQGIS But I could not get a valid syntax if there are two expressions. My code is the following. How do I fix it?
layer.selectByExpression("\"PNAME\"='{}'".format(river_name)AND "\"HUC\" = '{}'".format(huc))

layer.selectByExpression(f""PNAME"='{river_name}' AND "HUC" = '{huc}'")
– hiroaki Apr 06 '21 at 17:04