Python: convert a string representation of a list to a list

PHOTO EMBED

Tue May 26 2020 16:35:55 GMT+0000 (Coordinated Universal Time)

Saved by @tisg #python

import ast
l = ast.literal_eval('[ "A","B","C" , " D"]')
l = [i.strip() for i in l]
content_copyCOPY