How to strip unicode in a list

Viewed 18707

I want to strip unicode string from the list for example airports [u'KATL',u'KCID']

expected output

[KATL,KCID]

Followed the below link

Strip all the elements of a string list

Tried one of the solution

my_list = ['this\n', 'is\n', 'a\n', 'list\n', 'of\n', 'words\n']

map(str.strip, my_list) ['this', 'is', 'a', 'list', 'of', 'words']

got the following error

TypeError: descriptor 'strip' requires a 'str' object but received a 'unicode'

3 Answers
Related