1:首先我们来介绍几个函数
os.listdir(path);会得到这个给定的目录中的所有东西——文件和目录
os是python内置的模块叫做os操作系统(operating system)的简称。
rename(src,dst):给文件或文件夹改名(可以改路径,但是不能覆盖目标文件)
string.translate()requires a dict that maps unicode ordinals to other unicode oridinals (or None if you want to remove the character).
例如:
old_string = "file52.txt"
to_remove = "0123456789"
table = {ord(char): None for char in to_remove}
new_string = old_string.translate(table)
assert new_string == "file.txt"
However, there is simpler way of making a table though, by using the str.maketran