[Python] list 모양의 string을 list로 변환
>>> import ast >>> x = u'[ "A","B","C" , " D"]' >>> x = ast.literal_eval(x) >>> x ['A', 'B', 'C', ' D'] >>> x = [n.strip() for n in x] >>> x ['A', 'B', 'C', 'D'] 출처 : https://stackoverflow.com/questions/1894269/convert-string-representation-of-list-to-list