def _increment_numeric_suffix ( s ) : if re . match ( r".*\d+$" , s ) : return re . sub ( r"\d+$" , lambda n : str ( int ( n . group ( 0 ) ) + 1 ) , s ) return s + "_2"
add 1 to a letter to increment it python
Increment ( or add ) numeric suffix to identifier .
def _increment_numeric_suffix(s):
        """Increment (or add) numeric suffix to identifier."""
        if re.match(r".*\d+$", s):
            return re.sub(r"\d+$", lambda n: str(int(n.group(0)) + 1), s)
        return s + "_2"