擅长:python、mysql、java
<p>要生成或检索文件夹<code>img_folder</code>中随机图像的路径,并不太困难。您可以使用<code>img_path_array = os.listdir('.../img_folder')</code>。使用<code>random_index = randrange(len(img_path_array))</code>(导入<code>random</code>使用此函数)随机生成一个介于<code>0</code>和<code>len(img_path_array)</code>之间的整数,并通过调用<code>img_path_array[random_index]</code>获得对随机文件url的访问权。你知道吗</p>