python 下划线转驼峰

 

# 下划线转驼峰
def str2Hump(text):
    arr = filter(None, text.lower().split('_'))
    res = ''
    j = 0
    for i in arr:
        if j == 0:
            res = i
        else:
            res = res + i[0].upper() + i[1:]
        j += 1
    return res

 

posted @ 2019-04-28 15:30  zipon  阅读(2973)  评论(0编辑  收藏  举报