I'm currently using RegEx in Python to remove the underscores from a string, shown below:
def function_renamer(code):
newcode = re.sub('[_](.)', lambda x: x.group(1).upper(), code)
After that I'd like to find the words that had underscores to store them into a variable. Is it possible for me to do that? For example:
function_renamer("def a_random_function(x):")
>> "def aRandomFunction(x):"
Then store the changed string "aRandomFunction" in a variable.