How does python change the contents of a specified string?

example: change "ABc/AAAA aBc/AAAA / /" to "abc/AAAA abc/AAAA / /"
or "abc/AAAA dbc/AAAA" to" abe/AAAA dbe/AAAA"

how can you solve this problem by changing the size of letters in a specific part of a string or replacing letters? if you use the def custom function to solve this problem, how should you solve this problem?

Jan.20,2022

import re

def fun(str):
    m = re.match(r'(\w{3})/AAAA (\w{3})/AAAA',str)
    if m:
        st_str = str.replace(m.group(1),m.group(1).lower())
        new_str = st_str.replace(m.group(2),m.group(2).lower())

    else:
        new_str = str
    return new_str

def fun2(str, rp_str):
    m = re.match(r'(\w{3})/AAAA (\w{3})/AAAA',str)
    if m:
        st_str = str.replace(m.group(1)[-1], rp_str)
        new_str = st_str.replace(m.group(2)[-1],rp_str)

    else:
        new_str = str
    return new_str

if __name__ == '__main__':
    print(fun('Def/AAAA aBc/AAAA'))
    print(fun2('Def/AAAA aBc/AAAA', 'e'))
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37522-2c08c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37522-2c08c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?