I'm trying to make a selection using PyQGIS.

The short snippet I'm working with is

hej = iface.addVectorLayer('rs_map_Ale.shp', "", "ogr")

This works fine when selecting one row with a unique value, but "ALE" is in plenty of cells and I would like to select them all. I can't figure out how to write it. Tried a double = as well, didn't work.

1 Answer 1


Since ALE is a string, wrap it into single quotes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.