Get Layer Fields and File Path
roads_fn = 'C:/pyqgis/vector/tl_2019_16_prisecroads.shp' roads_lyr = QgsVectorLayer(roads_fn, 'roads', 'ogr') roads_lyr.name() roads_lyr.dataProvider().dataSourceUri() roads_lyr.fields() for field in roads_lyr.fields(): print(field) for field in roads_lyr.fields(): print(field) print(field.name()) print(field.type())