擅长:python、mysql、java
<p>Python中的更高版本使用:</p>
<pre><code>eg: oldname= "delhi123"
remove="1234567890"
table=str.maketrans("","",remove)
oldname.translate(table)
</code></pre>
<p>查询的总体解决方案:</p>
<pre><code>import os
def rename_file_names():
file_list=os.listdir(r"C:\Users\welcome\Downloads\Compressed\prank")
print (file_list)
saved_path=os.getcwd()
print("current working direcorty is"+saved_path)
os.chdir(r"C:\Users\welcome\Downloads\Compressed\prank")
remove="123456789"
table=str.maketrans("","",remove)
for file_name in file_list:
os.rename(file_name,file_name.translate(table))
rename_file_names()
</code></pre>