fork download
  1.  
  2. import os
  3. import random
  4.  
  5. import re
  6.  
  7.  
  8.  
  9.  
  10. phase_x = "PHASE 1: [Drive_Towards] [-, 24 to 34, -4 to -3][Ego: -10 to 0, FSR]"
  11. phase_y = "PHASE 1: [Walk_Towards] [-, 1 to 3, -3 to -5][Ego:-4 to -2, FSL]"
  12. LowerValue = 10
  13. HigherValue = 20
  14.  
  15.  
  16.  
  17. myRegex_1 = "\d+\sto\s\d+"
  18. myRegex_2 = str(LowerValue)+" to "+ str(HigherValue)
  19.  
  20.  
  21.  
  22. new_line_phase_x = re.sub(myRegex_1, myRegex_2, phase_x)
  23. new_line_phase_y = re.sub(myRegex_1, myRegex_2, phase_y)
  24.  
  25. print(new_line_phase_x)
  26. print(new_line_phase_y)
  27.  
  28.  
Success #stdin #stdout 0.04s 65472KB
stdin
Standard input is empty
stdout
PHASE 1: [Drive_Towards] [-, 10 to 20, -4 to -3][Ego: -10 to 20, FSR]
PHASE 1: [Walk_Towards] [-, 10 to 20, -3 to -5][Ego:-4 to -2, FSL]