(string)
return re.sub(r'\W|^(?=\d)', '_', string)
Converts string to correct Python variable name.
    Replaces unavailable symbols with _ and insert _ if string starts with digit.
Converts string to correct Python variable name.
    Replaces unavailable symbols with _ and insert _ if string starts with digit.
Converts string to correct Python variable name . Replaces unavailable symbols with _ and insert _ if string starts with digit .
def to_varname(string):
    """Converts string to correct Python variable name.
    Replaces unavailable symbols with _ and insert _ if string starts with digit.
    """
    import re
    return re.sub(r'\W|^(?=\d)', '_', string)
def to_varname ( string ) : import re return re . sub ( r'\W|^(?=\d)' , '_' , string )