擅长:python、mysql、java
<p>使用<code>strip()</code>函数可以消除一些您不需要的字符,例如:</p>
<pre><code>a = 'This is my string \x00\x00\x00'
b = a.strip('\x00') # or you can use rstrip() to eliminate characters at the end of the string
print(b)
</code></pre>
<p>您将得到<code>This is my string</code>作为输出。在</p>