擅长:python、mysql、java
<p>您可以使用内置的“拆分”功能:</p>
<pre><code>'abc eff 23 aaa|C:\\WINDOWS|\\Device\\Harddisk\\Parti'.split('|')[0]
</code></pre>
<p><a href="https://docs.python.org/3/library/stdtypes.html#str.split" rel="nofollow noreferrer">Here is the documentation on how it works if you are curious</a></p>