Реактивная собственная ошибка не может найти импорт символов com.facebook.react.uimanager.UIBlock, есть идеи?

>>> help(str.find)
Help on method_descriptor:

find(...)
    S.find(sub [,start [,end]]) -> int

Таким образом, мы можем сами построить:

def find_all(a_str, sub):
    start = 0
    while True:
        start = a_str.find(sub, start)
        if start == -1: return
        yield start
        start += len(sub) # use start += 1 to find overlapping matches

list(find_all('spam spam spam spam', 'spam')) # [0, 5, 10, 15]

Не требуется временных строк или регулярных выражений.

1
задан A DEv 17 January 2019 в 04:57
поделиться