从驼峰命名的串中提取单词子串形成数组

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#coding=utf8
result = []
def run2(name):
    for i in range(1,len(name)):
        if name[i].isupper():
            a = run2(name[i:])
            s = name[:i]
            a.append(s)
            return a
    return [name]

def run(name):
    s = len(result)
    for i in range(1,len(name)):
        if name[i].isupper():
            result.append(name[:i])
            run(name[i:])
            break

    if s == len(result): result.append(name)
    pass

def main():
    run('firstNameWomen')
    print result
    result2 = run2('firstNameWomen')
    print result2
    pass

if __name__ == '__main__':
    main()