OK, I found it !

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


But...  what about to have the field names ?

Thank you

Roberto


2013/10/23 Geo DrinX <geodr...@gmail.com>

> 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
>
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to