Ejemplo n.º 1
0
def clean_string(s):
    for c in sep[:-2]: # do not remove dashes ('-')
        s = s.replace(c, ' ')
    parts = s.split()
    result = ' '.join(p for p in parts if p != '')

    # now also remove dashes on the outer part of the string
    while result and result[0] in sep:
        result = result[1:]
    while result and result[-1] in sep:
        result = result[:-1]

    return result
Ejemplo n.º 2
0
def clean_string(s):
    for c in sep[:-2]:  # do not remove dashes ('-')
        s = s.replace(c, ' ')
    parts = s.split()
    result = ' '.join(p for p in parts if p != '')

    # now also remove dashes on the outer part of the string
    while result and result[0] in sep:
        result = result[1:]
    while result and result[-1] in sep:
        result = result[:-1]

    return result
Ejemplo n.º 3
0
def find_words(s):
    return _words_rexp.findall(s.replace('_', ' '))
Ejemplo n.º 4
0
def iter_words(s):
    return _words_rexp.finditer(s.replace('_', ' '))
Ejemplo n.º 5
0
def find_words(s):
    return _words_rexp.findall(s.replace('_', ' '))
Ejemplo n.º 6
0
def iter_words(s):
    return _words_rexp.finditer(s.replace('_', ' '))
Ejemplo n.º 7
0
def iter_words(s):
    return _words_rexp.finditer(s.replace("_", " "))
Ejemplo n.º 8
0
def find_words(s):
    return _words_rexp.findall(s.replace("_", " "))