Thanks for that - I wouldn't have known where to look. But this does the trick - although for my application I did have a need to explicitly convert the QString types to unicode. <br>I looked at methods toAscii() and toLatin1() but neither produced the python string types I was expecting. Can you comment on that?<br>
<br>Many thanks again<br>Ole<br><br><br><div class="gmail_quote">On Wed, Dec 7, 2011 at 8:06 AM, Giuseppe Sucameli <span dir="ltr"><<a href="mailto:sucameli@faunalia.it">sucameli@faunalia.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Ole,<br>
to get the field names you have to use the vector data provider.<br>
<br>
If vl contains the vector layer than:<br>
<br>
<br>
provider = vl.dataProvider() # QgsVectorDataProvider<br>
fields = provider.fields() # QMap<int, QgsField><br>
<br>
... # vl.select(), feat = QgsFeature(), while vl.nextFeature(feat):<br>
<br>
attrs = feat.attributeMap()<br>
for (k,attr) in attrs.iteritems():<br>
name = fields[ k ].name()<br>
print "%s: %s" % (name, attr.toString())<br>
<br>
<br>
Regards.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Giuseppe Sucameli<br>
</font></span></blockquote></div><br>