编写程序实现:在实验数据目录中建立子目录copyImg;将实验数据目录中的sea.jpg图片文件拷贝10份到建立的copyImg目录中,文件名依次为seaCopy1.jpg , … , seaCopy10.jpg。
import os
f_obj=open("f:\sea.jpg",'rb')
f_content=f_obj.read()
os.makedirs('f:\copylmg')
for i in range(1,11):
b='sea-copy'+str(i)+'.jpg'
fnew=open("f:\copylmg\b",'wb')
fnew.write(f_content)
fnew.close()
print('图片已成功拷贝.')
一下是图片