I am a newbie with Python and I search how to parse a .txt file. My .txt file is a namelist with computation informations like :
myfile.txt
var0 = 16
var1 = 1.12434E10
var2 = -1.923E-3
var3 = 920
How to read the values and put them in myvar0, myvar1, myvar2, myvar3
in python?
MissingSectionHeaderError
if the file does not contain section headers and OP's example does not have headers. The custom solution by @Lauritz is probably simpler than possible workarounds for using configparser with no headers.