Sep-14-2018, 09:35 AM
I am not a programmer, that is easy to see. I have a lot of trouble with the indentation. I write little routines using the idle3 environment. I just got this working, to put photos in an excel file.
Idle3 is set to 4 spaces = 1 tab, but when I press tab, I often seem to get more than 4 spaces. This below works for me on my computer, in the idle3 shell and in a terminal. If I change it at all, my little routine does not run, or does not do what I want.
If you have a link to some advice on indentation, I would like to read it! Thanks!
Idle3 is set to 4 spaces = 1 tab, but when I press tab, I often seem to get more than 4 spaces. This below works for me on my computer, in the idle3 shell and in a terminal. If I change it at all, my little routine does not run, or does not do what I want.
If you have a link to some advice on indentation, I would like to read it! Thanks!
for sheet in sheets:
activeDirectory = pathToPhotos + sheet + '/'
print('the active photo directory is ' + activeDirectory)
for filename in os.listdir(activeDirectory):
if not (filename.endswith('.jpg')):
continue
for rowNum in range(beginRow, wb[sheet].max_row + 1):
getName = filename.split('.')
if (getName[0] == wb[sheet].cell(row=rowNum, column=col).value):
print('found the name! Name is: %s ' % (getName[0]))
print('Putting pic in row ' + str(rowNum))
img = Image(activeDirectory + filename)
wb[sheet].add_image(img, 'A' + str(rowNum))
