使用os和shutil模块的示例:
from os.path import joinfrom os import listdir, rmdirfrom shutil import moveroot = 'dstfolder/slave1'for filename in listdir(join(root, 'slave')): move(join(root, 'slave', filename), join(root, filename))rmdir(root)

使用os和shutil模块的示例:
from os.path import joinfrom os import listdir, rmdirfrom shutil import moveroot = 'dstfolder/slave1'for filename in listdir(join(root, 'slave')): move(join(root, 'slave', filename), join(root, filename))rmdir(root)