擅长:python、mysql、java
<p><code>rf.rarfile</code>是文件的名称,通过打印其值可以看到该文件。删除它并检查您想要的方法<code>help(rarfile.RarFile)</code>。在</p>
<pre><code>import rarfile
rarpath='/home/maze/Desktop/test.rar'
def unrar(file):
rf=rarfile.RarFile(file)
rf.extractall()
unrar(rarpath)
</code></pre>