A. Archer A. Archer - 1 year ago 56
Python Question

split list by delimited in python

From a dict/list, how to split the list by \n. Eg:

In [1]: d = {'key1': 'value1\n value2 \n value3\n'}

In [2]: d.values()
Out[2]: ['value1\n value2 \n value3\n']

Desired output:

['value1', 'value2 ', 'value3']

I looked at existing examples but couldn't find this specific one.

Answer Source

Here you go: