我的代码:
red_images = 'DDtest/210red.png'
green_images = 'DDtest/183green.png'
b = [red_images, green_images]
shuffle(b)
Run Code Online (Sandbox Code Playgroud)
我有几百张图片,为了让我的代码尽可能简洁(并扩展我的 Python 知识),我想知道如何编写代码来自动获取文件夹中的文件并将它们列为列表。
我在 R 中做过类似的事情,但我不知道如何在 python 中做到这一点。