I have a file(text) which contains data and below is one of the lines from the file
"xiakuram_4bitaddrk1.xifull_addrk2.xx1.xxdrv.xmna.mn1 0.0000e+00 5.0000e-07 5.0000e-07 Vd = (1.456e-05, 1.479e-05) Vg = (1.08, 1.08) Vs = (0, 0) Vb = (0, 0)"
I only want to extract 5.0000e-07 from the line.(using python)
Can anyone help me with this?
Assuming the number you want to extract is always right before Vd
:
Vd
in the listIn python:
data = "xiakuram_4bitaddrk1.xifull_addrk2.xx1.xxdrv.xmna.mn1 0.0000e+00 5.0000e-07 5.0000e-07 Vd = (1.456e-05, 1.479e-05) Vg = (1.08, 1.08) Vs = (0, 0) Vb = (0, 0)"
word_list = data.split(" ")
time_period = word_list[word_list.index("Vd")-1]
print(time_period)
Output:
5.0000e-07
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.