Page 1 of 1

Python: sub Function

Posted: Sat Aug 16, 2025 2:54 pm
by Jason

Code: Select all

import re

band_name = "Shocking Green"

print(band_name)

new_band_name = re.sub("Green", "Blue", band_name)

print(new_band_name)

# prints out "Shocking Blue"