Пример #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
Пример #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
Пример #3
0
def find_words(s):
    return _words_rexp.findall(s.replace('_', ' '))
Пример #4
0
def iter_words(s):
    return _words_rexp.finditer(s.replace('_', ' '))
Пример #5
0
def find_words(s):
    return _words_rexp.findall(s.replace('_', ' '))
Пример #6
0
def iter_words(s):
    return _words_rexp.finditer(s.replace('_', ' '))
Пример #7
0
def iter_words(s):
    return _words_rexp.finditer(s.replace("_", " "))
Пример #8
0
def find_words(s):
    return _words_rexp.findall(s.replace("_", " "))