def replace(path, pattern, replacement):
    updated = []
    with open(path, 'r') as f:
        for line in f:
            updated.append(((replacement + '\n') if line.startswith(pattern) else line))
    with open(path, 'w') as f:
        for line in updated:
            f.write(line)
def replace(path, pattern, replacement):
    updated = []
    with open(path, 'r') as f:
        for line in f:
            updated.append(((replacement + '\n') if line.startswith(pattern) else line))
    with open(path, 'w') as f:
        for line in updated:
            f.write(line)