Take part of a regex search result in Python -


I want to read in a header file and each x = 1.0; / Code> as double = x;

For the moment I have found this, which only output to the whole line:

  import re input to the input in the input = open ("file_with_vars .hpp ", 'r') = Open (" output.txt ", 'w'): if re.match (" (. *) = (\ D) ", line): Print & gt; & Gt; Line out, line  

But how can I remove a part of the line and output the name of the variable and double string file?

Edit: So now I have

  for the row in the cell: m = re.search ('(. *) \ S * = \ s * ( \ D + \. \ D +) ', line) print m.group ()  

but error' AttributeError: 'NoneType' object has no attribute 'group' '

Comments