Question: Could anybody provide an example how to get the attributes of selected features?

I tried the following code in the Python Console : but I'm stuck at the point where I'd like to get the attributes:

```py
from qgis.utils import iface

canvas = iface.mapCanvas()
cLayer = canvas.currentLayer()
selectList = []

if cLayer:
    count = cLayer.selectedFeatureCount()
    print (count)
    selectedList = layer.selectedFeaturesIds()

    for f in selectedList:
        # This is where I'm stuck
        # As I don't know how to get the Attributes of the features

```

Answer: 
This will work:

```py
layer = iface.activeLayer()

features = layer.selectedFeatures()

for f in features:
    print f.attributeMap()

```

In PyQGIS 3:

```py
layer = iface.activeLayer()

features = layer.selectedFeatures()

for f in features:
    # refer to all attributes
    print (f.attributes()) # results in [3, 'Group 1', 4.6]

for f in features:
    # refer to a specific values of a field index
    print(f.attribute(1)) # results in Group 1

```
**For QGIS 3.10**

Not sure if this post was asking for it in a list...

Print field of selected features

```py
layer = iface.activeLayer()

for feature in layer.selectedFeatures():
    print(feature['field name'])

```

Create list of selected features

```py
layer = iface.activeLayer()

list = []

for feature in layer.selectedFeatures():
    list.append(feature['field'])

print(list)

```