fork download
  1. import re
  2. p = re.compile(r'[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?')
  3. strs = ["4x5x6", "7.2volt", "60BTU", "20v", "4*5", "24in"]
  4. print([p.sub(r" \g<0> ", x).strip() for x in strs])
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
['4 x 5 x 6', '7.2 volt', '60 BTU', '20 v', '4 * 5', '24 in']