python copy files by wildcards

后端 未结 3 827
梦毁少年i
梦毁少年i 2020-11-30 04:41

I am learning python (python 3) and I can copy 1 file to a new directory by doing this

import shutil 
shutil.copyfile(\'C:/test/test.txt\', \'C:/lol/test.txt         


        
3条回答
  •  执笔经年
    2020-11-30 05:19

    Use glob.glob() to get a list of the matching filenames and then iterate over the list.

提交回复
热议问题