Created
September 15, 2025 00:53
-
-
Save pmgreen/3662b05c16757ecda977724887207da9 to your computer and use it in GitHub Desktop.
Get field names from QGIS attribute table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generated from multiple sources by Brave Leo (AI) | |
# from the Python console in QGIS: | |
# activate the layer you want field names for and then enter... | |
from qgis.utils import iface | |
layer = iface.activeLayer() | |
prov = layer.dataProvider() | |
field_names = [field.name() for field in prov.fields()] | |
for f in enumerate(field_names): | |
print(f"{f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment