| Python | | copy code | | ? |
| 1 | #Example, key = file name in list, value = path+filename |
| 2 | import os |
| 3 | path = os.path.abspath(os.path.dirname(__file__)) |
| 4 | mylist = ['harry.png', 'andy.png', 'dan.png'] |
| 5 | aDict = dict([(fn, os.path.join(path, fn)) for fn in mylist]) |