[Qgis-developer] How to get the field values in PyQGis 2 ?

Geo DrinX geodrinx at gmail.com
Wed Oct 23 01:50:26 PDT 2013


Hello all,

I have difficulties writing the python code to print the field value
contents from a feature.

This is my source code:

                    iter = layer.getFeatures()
                    for feat in iter:
                      fff = feat.fields()
                      num = fff.count()
                      print "num %d\n" %(num)
                      for iii in range(num):
                         fieldValue = fff[iii]
                         print "%s\n" %(fieldValue)

but this is what I had:

<qgis.core.QgsField object at 0x000000000BF95268>

etcetera....


What I need to modify in the source code to have the correct string values ?

Sorry, but the 2.0 documentation is not so clear... actually  :(


Thank you in advance for any info about this

Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131023/de53679e/attachment.html>


More information about the Qgis-developer mailing list