I am using Python and regex to try and search for text. Given the string within a text file:
line = (<layerThickness> 0.58 </layerThickness>)
I am trying to assign 0.58 to variable L, however the output is consistently, “<_s” rather than the decimal value. This is what I have been trying:
L = re.search(r"([-+]?[0-9]*\.?[0-9]+)", line)
Any help is appreciated!
Perhaps you just need to call the
.group()method:yields