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

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -