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
Post a Comment