code: def PrintColumns(shapefile):
    
    ds = ogr.Open(shapefile)
    layer = ds.GetLayer(0)
    if len(layer) == 0:
      raise ShapeImporterError("Layer 0 has no elements!")
  
    feature = layer.GetFeature(0)
    print("%d features" % feature.GetFieldCount())
    for j in range(0, feature.GetFieldCount()):
      print('--' + feature.GetFieldDefnRef(j).GetName() + \
            ': ' + feature.GetFieldAsString(j))
docs: Print the columns of layer 0 of the shapefile to the screen.