79707981

Date: 2025-07-20 12:33:59
Score: 0.5
Natty:
Report link

Are you looking for something like that?

def replace_number(match):
    original = match.group(0)
    new_value = "100"
    # Pad or truncate to match original length
    padded = new_value.rjust(len(original))[:len(original)]
    return padded

for i in range(len(lines)):
    lines[i] = re.sub(r'(?<!\S)(-?\d+(?:\.\d+)?)(?!\S)', replace_number, lines[i])
Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: Yusuf K.