擅长:python、mysql、java
<p>试着这样做:</p>
<pre><code>text = 'abcdefg=12345'
head, sep, tail = text.partition('=') + "=456789"
>>> print head
abcdefg=456789
</code></pre>
<p>从文档中:</p>
<blockquote>
<p>partition(...) S.partition(sep) -> (head, sep, tail)</p>
<p>Searches for the separator sep in S, and returns the part before it,
the separator itself, and the part after it. If the separator is not
found, returns S and two empty strings.</p>
</blockquote>