Python: replace a decimal number in a string -


i have strings in number of files:

 step.m                                   0.02540:step length 

(notice space in first character of string) in of files, there additional spaces between characters:

step . m                                   0.02540 : step length 

how can replace decimal number decimal number? i.e. want this:

step.m                                   1.50000:step length 

edit add: naturally, decimal number not same in each file.

think mean this,

re.sub(r'\d+\.\d+', '1.50000', s) 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -