If you want to either replace one string with another string or to change the order of characters in a string, use re.sub
.
re.sub
allows you to use a regular expression to specify the pattern of the string you want to swap.
In the code above, I replace 3/7/2021 with Sunday and replace 3/7/2021 with 2021/3/7.