擅长:python、mysql、java
<p>我相信您所需要做的就是通过<code>strip()</code>函数运行最后一个字符串。你知道吗</p>
<blockquote>
<p><strong><code>str.strip([chars])</code></strong> </p>
<p>Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. <strong>If omitted or None, the chars argument defaults to removing whitespace.</strong> </p>
</blockquote>
<p>因此,循环中的命令如下所示:</p>
<pre><code>SID = line.split( ":" )[ 1 ].strip()
</code></pre>
<p>参考文献:</p>
<ul>
<li><a href="http://docs.python.org/2/library/stdtypes.html#str.strip" rel="nofollow">^{<cd1>}</a></li>
</ul>