Python批量导入文件夹里面的图片

import os
import win32clipboard as w
import win32con

FileName = os.listdir('D:\\workSpace\\17957\\Reptile\\demo\\imgs')
Front = input("请输入前置文件名:")
Num = int(input("请输入文件数目:"))
End = input("请输入扩展名:")
FilePosition = os.getcwd()


def settext(aString):
    w.OpenClipboard()
    w.EmptyClipboard()
    w.SetClipboardData(win32con.CF_UNICODETEXT, aString)
    w.CloseClipboard()


while 1 == 1:
    Start = input("请输入起始编号:")
    Name = Front + Start + '.' + End
    position = FileName.index(Name)

    Text = ''
    for i in range(Num):
        Name = FileName[i + position]

        Long = FilePosition + '\\' + Name
        Super = ''
        Text = Text + Super + '\n'
    settext(Text)
    print(Text)

运行结果
将运行的结果复制下来
打开office
找到需要复制的起始单元格,右击复制,找到选择性复制里面的unicode复制
将运行结果放到里面

你可能感兴趣的:(Python批量导入文件夹里面的图片)