[The original question] Does not address not when you don't know the postion of that last occurrence 1I want to replace the last occurrence of the "," with a blank, the code below only replaces all the "," in the line variable
def create_payload ():
line = 'post_iceauth_oauth_token_helper, \n'
if regex.search(",", line):
temp = regex.sub(",", "", temp) # remove the (, )
This is not explaining the last replacement it only speaks of knowing position