擅长:python、mysql、java
<p>您可以使用标准的字符串工具,这些工具通常更具可读性。</p>
<p><code>s = "start: c12354, c3456, 34526;"</code></p>
<p><code>s.startswith("start:") # returns a boolean if it starts with this string</code></p>
<p><code>s.endswith(";") # returns a boolean if it ends with this string</code></p>
<p><code>s[6:-1].split(', ') # will give you a list of tokens separated by the string ", "</code></p>