0

I need to obtain, for each feature of a layer, a dictionary with the attribute names and its values using PyQGIS.

I can get all the attributes of the layer using

indiv = QgsProject.instance().mapLayersByName('Individuos')[0]

for feature in features: value = feature[field.name()] attrs = feature.attributes() print(attrs)

But what I need is to create a dictionary with field names as key and their value for each feature.

Raúl Casado
  • 1,069
  • 7
  • 19

0 Answers0