Is it possible using Python to select all features whose attribute contain a specific string?
I am new to QGIS.
The layer has an address column ("Bauvorha_3") which looks like this:
Berlin, Am Alexanderplatz, ...
Berlin, Goethestrasse, ...
Hamburg, Alsterufer, ...
Hamburg, Reeperbahn, ...
I need to select all features containing for example "Hamburg" or "ufer".
place is the user-input string. I've tried to use LIKE but it doesn't seem to work for me.
place = self.dlg.lineEdit.text()
place = str(place)
versuch = "'{}'".format(place)
search = '"Bauvorha_3" LIKE "{}%"'.format(versuch)
self.iface.activeLayer().selectByExpression(search)
""""Bauvorha_3" LIKE('%{0}%')""".format(place)