我想使用 python 将 "Onehundredthousand"
拆分为 "one"
"hundred"
"thousand"
.
我该怎么做?
最佳答案
您可以使用字符串的 partition
方法将其拆分为 3 部分(左侧部分、分隔符、右侧部分):
"onehundredthousand".partition("hundred")
# output: ('one', 'hundred', 'thousand')
关于python - 字符串在python中拆分为单独的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36786331/