my code so far:
import os
root = os.listdir("/path/to/dir")
pic_dir = {}
len_wallpaper = int((24 / (len(root))))
for i in range(24):
if i<10 :
pic_dir[(f"{0}{i}")] = root[0]
else:
pic_dir[i] = root[0]
print(pic_dir)
current output:
{'00': 'file_1', '01': 'file_1', '02': 'file_1', ... '23': 'file1'}
This is good so far, but what I really want is to loop through the files n times, so they will add to the list n times and then move onto the next file. So more like this:
{'00': 'file_1', '01': 'file_1', '02': 'file_1', ...
'07': 'file2', '08': 'file2', ...
'22': 'file4', '23': 'file4'}
The directory will hold pictures, and my end goal is to create some sort of dynamic wallpaper that changes based on the time.
'len_wallpaper' calculates the amount of times a file needs to be ran through this loop.
Can this be done by using a nested loop of some kind?