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 -

python - ValueError: could not convert string to float -

php - Laravel Get all child node count with condition -