擅长:python、mysql、java
<p><a href="https://docs.python.org/2/library/string.html#string.split" rel="nofollow noreferrer">^{<cd1>}</a>允许您根据分隔符(这里是<code>/</code>和<code>-</code>)将字符串分解为一个部分列表。在</p>
<pre><code>s = 'ttt-OPP/MKKL-7/LNFFF-74/OOOP-71/AAD-1/RRR-232'
print s.split('/')[2].split('-')[1]
# 74
</code></pre>
<p>使用<a href="https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html" rel="nofollow noreferrer">^{<cd4>}</a>将其应用于列</p>
^{pr2}$
<p>输出</p>
<pre><code> a b
0 ttt-OPP/MKKL-7/LNFFF-74/OOOP-71/AAD-1/RRR-232 74
1 ttt-OPP/MKKL-7/LNFFF-89/OOOP-71/AAD-1/RRR-232 89
</code></pre>
<p>注意:用<a href="https://stackoverflow.com/a/44885290/1545917"><em>@A-Za-z</em></a>的溶液,比我的快。在</p>