@DiapDealer
Crossing the fingers, here is
pingouin2 which takes into account your previous remark.
Code:
#!/usr/bin/python
import sys, re
conv=2.37106301584
unit=re.compile('(:\s*)(-?[\d.]+)(cm)?(;|})')
with open(sys.argv[1],'r') as f, open(sys.argv[2],'w') as g :
fic=f.read()
while True :
k=unit.search(fic)
if(k) :
g.write(fic[:k.start(1)])
g.write(k.group(1))
val=k.group(2)
unite=k.group(3)
if unite=='cm' :
val="%.2f"%(conv*float(k.group(2)))
unite='em'
else : unite=''
g.write(val+unite)
g.write(k.group(4))
fic=fic[k.end(4):]
else :
g.write(fic)
break
With the new release, I will make another round of testing involving some other people. I suppose this release will also be working for both Python 2.x and 3.x. If you take Kovid Goyal's advice, please provide some comments as this is way above my head.