In this example, we're loading a shapefile with layer name "My layer". The "ogr" parameter specifies the data provider, which in this case is OGR (a library used for reading and writing geospatial data formats). Example 2: Querying and editing feature attributes Once you have a QgsVectorLayer instance, you can use the `getFeatures()` method to retrieve a QgsFeatureIterator object, which allows you to iteratively access each feature in the layer. You can then use the `attribute()` and `setAttribute()` methods of QgsFeature to retrieve and modify the feature's attributes.python from qgis.core import QgsVectorLayer layer = QgsVectorLayer("path/to/shapefile.shp", "My layer", "ogr") if not layer.isValid(): print("Error loading layer:", layer.name()) else: print("Layer loaded successfully:", layer.name()) # Print all feature attribute values for feature in layer.getFeatures(): attrs = feature.attributes() print(attrs) # Change the value of a specific attribute for feature in layer.getFeatures(): if feature["Name"] == "ABC": feature.setAttribute("Type", "City") layer.updateFeature(feature) ``` In this example, we're iterating over all features in the layer and printing out their attribute values. We're also updating the "Type" attribute of the feature with "Name" equal to "ABC" and saving the changes to the layer using the `updateFeature()` method. Package library: This example uses the qgis.core package library.