Ejemplo n.º 1
0
def name_ascii(name,ext=''):
  spechars = '"',"'",'-','#','&','|',' ','.',',','!',':',';','%','£','$','*','(',')','[',']','{','}','=','+','^','§','°','`','@','?','/', '\xc2\xa0'
  for sp in spechars: name = name.replace(sp,'_')
  name = unac.unac_string(name)
  name = re.sub(r'([_])\1+', r'\1', name) # remove repeting
  name = re.sub(r'^([_])+', '', name) # remove starting
  if name[-1]=='_': name = name[:-1]
  return (name+ext).lower()
Ejemplo n.º 2
0
Archivo: vsutils.py Proyecto: vrx/vspy
def name_ascii(name, ext=""):
    spechars = (
        '"',
        "'",
        "-",
        "#",
        "&",
        "|",
        " ",
        ".",
        ",",
        "!",
        ":",
        ";",
        "%",
        "£",
        "$",
        "*",
        "(",
        ")",
        "[",
        "]",
        "{",
        "}",
        "=",
        "+",
        "^",
        "§",
        "°",
        "`",
        "@",
        "?",
        "/",
        "\xc2\xa0",
    )
    for sp in spechars:
        name = name.replace(sp, "_")
    name = unac.unac_string(name)
    name = re.sub(r"([_])\1+", r"\1", name)  # remove repeting
    name = re.sub(r"^([_])+", "", name)  # remove starting
    if name[-1] == "_":
        name = name[:-1]
    return (name + ext).lower()
Ejemplo n.º 3
0
def remove_accents(s):
    #return unicodedata.normalize('NFKD',u).encode('ascii','ignore')
    return unac.unac_string(s)