def to_camel_case(text): if text == '': return text for i in text: if i == '-' or i == '_': text = text.replace(text[text.index(i):text.index(i)+2], text[text.index(i)+1].upper(), 1) return text