fork download
  1. import re
  2.  
  3. r = re.compile("(Value:)([-+]?[0-9]*\.?[0-9]+)")
  4. to_replace = "Value:0.99" # Want Value:1.00
  5. print(re.sub(r, r'\g<1>1.00', to_replace))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
Value:1.00