Q:

format a string without lossing its list format, python

I have a string file that looks like this:
["2004" "0" "23" "4.5"]
["2004" "0" "26" "4.8"]
["2004" "0" "16" "3.5"]
["2004" "0" "25" "7.5"]

However at the time that I try to manipulate it, the program gives me an error, this doesn't reads the
" (of course), I've been looking for a code that not only eliminates that char but also [ and that keeps my list instead of concatenating it into a whole line. Any ideas?
the final outcome will be exactly the same but without 
[" " " " " " "    "]

the code that I'm using is the following:
final= re.sub(r'[^0-9.\s\n], r' ', list)

what this is doing is:
2004 0 23 4.5 2004 0 26 4.8

A:

Indeed there is a lot of ways to solve this problem. Using the combo maktrans + replace + split should be an approach.
from string import maketrans

text = """["2004" "0" "23" "4.5"]
["2004" "0" "26" "4.8"]
["2004" "0" "16" "3.5"]
["2004" "0" "25" "7.5"]"""

parsed = text.translate(maketrans('" ', '#,')).replace('#', '').split('\n')
parsed = [eval(i) for i in parsed]

