Hello and welcome. I’d encourage you to post the code you are having trouble with. That way we can correct and guide you.
To get you started, I have written a small example. Try to run each line one at a time so you can see what the individual lines do.
import pymel.core as pm
import json
# get a flattened list of selected faces on pCube1
faces = pm.selected(fl=True)
print 'faces:', faces
idxList = [f.index() for f in faces]
print 'idxList:', idxList
# create locator with string attr
locShape = pm.createNode('locator', ss=True)
loc = locShape.getParent()
loc.addAttr('componentIndexList', dt='string')
# use json to dump the list into the string attr
loc.componentIndexList.set(json.dumps(idxList))
# get index list using json to load the data from the string attr
idxList2 = json.loads(loc.componentIndexList.get())
print 'idxList2:', idxList2
# reconstruct faces list
faces2 = ['pCube1.f[%i]'%idx for idx in idxList2]
print 'faces2:', faces2
# reselct faces
pm.select(faces2)
David