擅长:python、mysql、java
<p>除非您知道数据的确切长度(名称可以是“jack”或“theodore”,只是说说而已),否则在空格处拆分可能是一种更聪明的方法。这是一种细线切割,但不那么静态。你知道吗</p>
<pre><code>>>> s = 'num score ping guid name lastmsg address'
>>> num, score, ping, guid, name, lastmsg, address = s.split()
</code></pre>
<p>如果这些值可能包含空格,那么必须使用regex。你知道吗</p>