I have a python data-structure as follows:
A = [{\'abc\': \'kjkjl\'},{\'abc\': \'hjhjh\'},{\'abc\': \'78787\'}]
How can I remove the \'abc\' fr
B = []
for key, value in A.iteritems():
B.append(value)
Given your list as
>>> A
[{'abc': 'kjkjl'}, {'abc': 'hjhjh'}, {'abc': '78787'}]
You can do something like
>>> list(itertools.chain(*[x.values() for x in A]))
['kjkjl', 'hjhjh', '78787']
>>>
You can use list comprehension:
B = sum((i.values() for i in A), [])
>>> B = [a["abc"] for a in A]
>>> B
['kjkjl', 'hjhjh', '78787']
If all the dicts in A only have one element, you can do this ...
>>> A = [{'abc': 'kjkjl'},{'abc': 'hjhjh'},{'abc': '78787'}]
>>> B = [x.values()[0] for x in A]
>>> B
['kjkjl', 'hjhjh', '78787']