# -*- coding: UTF-8 -*- # python 3.9.0 64bit def hump2Underline(text): res = [] for index, char in enumerate(text): if char.isupper() and index != 0: res.append("_") res.append(char) return ‘‘.join(res).lower() def underline2Hump(text): arr = text.lower().split(‘_‘) res = [] for i in arr: res.append(i[0].upper() + i[1:]) return ‘‘.join(res)
原文:https://www.cnblogs.com/sinicheveen/p/14119910.html