wb = QgsVectorLayer('OptimalPattern', 'ogr')
qgis.utils.iface.setActiveLayer(wb) 
A = 0 ; templist = []
layer = qgis.utils.iface.activeLayer() # Sets the selected layer as the active layer
A = Crops + Outlets + 3 
for j in range(0,Crops):
    A = A + 1 ; templist.append(A)
res = layer.dataProvider().deleteAttributes(templist) # The [0] represents the 1st field, so [1] is the 2nd field etc. To delete multiple fields, use the comma to separate. Eg. [0, 2, 4]
layer.updateFields()