擅长:python、mysql、java
<p><code>re.split()</code>是与Python正则表达式库(<code>re</code>)关联的split()函数。在</p>
<p>在本例中,函数将在行中查找与<code>re.split()</code>函数中显示的模式匹配的任何子字符串。在</p>
<p>模式:<code>",* *\w*: "</code>以以下方式出现:</p>
<pre><code>",* > matches zero OR more commas
* > matches zero OR more spaces
\w* > matches zero OR more word characters (0-9, a-z, A-Z, _)
: " > matches a colon followed by a space
</code></pre>
<p>基本上,它试图找到:</p>
<p><code>surname:</code></p>
<p><code>, prename:</code></p>
<p><code>, profession:</code></p>
<p>在找到这些模式的地方,它们被从行中剥离出来,留下列表中显示的值。在列表的第一个位置找到的空字符串<code>''</code>是因为如果拆分模式是字符串中的第一个或最后一个元素,<code>split()</code>函数包含一个空字符串。在</p>