Ich möchte in meinem Text File die Zeichen "[" , "]" und " ' " eliminieren.
Textfile:
['-0.318', '-3.350', '58.140', '17.990']
['-0.364', '3.650', '55.140', '10.990']
['-0.535', '-6.350', '53.140', '15.990']
['-0.584', '-2.350', '62.140', '8.990']
['-0.902', '2.650', '54.140', '8.990']
['-1.600', '-1.350', '52.140', '9.990']
usw....
Mein Code:
Code: Alles auswählen
input1 = file('parsed_percent.txt','r')
input2 = input1.read()
input3 = input2.replace("[","")
input4 = input3.replace("]", "")
input5 = input4.replace("'", "")
output = file('parsed_percent.txt','w')
output.write(input5)
output.close()
Wüsste jemand von Euch jemand eine elegantere Lösung?
Besten Dank