I have a problem with a command of python. I want my program to read a specific line from my file, and here I haven't problem. The problem is when I have to convert the line in a float (I need of float to calculate some equation). My program is:
f=open('coeff.txt')
lines=f.readlines()
k1=lines[0]
k1 = float(k1)
k2=lines[1]
k2 = float(k2)
k3=lines[2]
k3 = float(k3)
k4=lines[3]
k4 = float(k4)
And the file coeff.txt is:
1.2*1e-1
6.00*1e-34
1.13*1e-4
6.9*1e-16
that is 1.2*10^(-1) , 6*10^(-34), 1.13*10^(-4), 6.9*10^(-16)
and I get the error:
ValueError: could not convert string to float: '6.00*1e-34\n'
(obviously that this error is referred to each line.
Can you help me, please?