I'm reading in lines of data from a file in this format:
['A', 'B', 'C', 'D', 'E']
['1', '2', '3', '4', '5']
...etc
However, when I do type(dataInput[0])
, it tells me it's from type string. Although it looks like a list with the brackets and all. How can i make dataInput[0]
directly into a list instead of string?
Here's some code:
fobj = open(selectedCase, 'r').read()
dataInput = re.split('\n', fobj)
I've seen threads such as: How to convert comma-delimited string to list in Python? However that example doesn't have brackets in the string.