阅读背景:

Python:最有效的分割和分析字符串的方法

来源:互联网 

I know from other answers that using string.split() over Regex will be a lot faster with short strings. A particular script I am working on requires me to split a string on a delimiter and analyze every split a particular way depending on how many delimiters it is after. For example, my string may look like abd-123-32-few-333-1212 etc....in this case, the delimiter is a '-'. Depending on the situation, I will either need a few or all of the splits (aka, for this example, I may need 32 and 333 and I will need to know that the 32 is after the 2nd dash and the 33 after the 4th). I know from other answers that using string.spl




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: