【发布时间】:2014-06-05 16:23:58
【问题描述】:
当字符串在一个单词中从小写转换为大写时,我试图拆分它。
例子:
'New Hampshire, State ofColorado, State ofU.S. Court of Appeals for the D.C. CircuitDistrict of Columbia Court of AppealsMaine, State of'
拆分后的字符串应该是什么样子:
['New Hampshire, State of',
'Colorado, State of',
'U.S. Court of Appeals for the D.C. Circuit',
'District of Columbia Court of Appeals',
'Maine, State of']
【问题讨论】:
-
显示一些代码。您是否尝试过解决此问题?正则表达式实际上是一个要求,还是您可以循环遍历字符串并根据需要拆分?
-
我已将您的问题编辑为我认为您要问的内容 - 您能否查看它以仔细检查这是否符合您的理解? “解析出来”不是很清楚。
标签: python regex string python-3.x