Reputation: 61
I want to remove specific value from a Unicode list i.e field
u'abv,( field),apn,army,elev,fema'
But when i try something like result.remove ('(field)')
it stops working and gives an error ?
Upvotes: 3
Views: 163
Reputation: 5950
Convert it into list and use remove
s = u'abv,( field),apn,army,elev,fema'
res = s.split(",")
res.remove("army") # lets assume we need to remove army
['abv', '( field)', 'apn', 'elev', 'fema']
You can make your output list back to string as well, if you wish
output = ",".join(res)
'abv,( field),apn,elev,fema'
Upvotes: 3