Python: convert camel case to space delimited using RegEx and taking Acronyms into account

后端 未结 10 1938
逝去的感伤
逝去的感伤 2020-12-29 04:38

I am trying to convert camel case to space separated values using python. For example:

divLineColor -> div Line Color

This lin

10条回答
  •  盖世英雄少女心
    2020-12-29 05:06

    I know, it's not regex. But, you can also use map like this

    >>> s = 'camelCaseTest'
    >>> ''.join(map(lambda x: x if x.islower() else " "+x, s))
    'camel Case Test'
    

提交回复
热议问题