Question Is there way add numbers 0-9 and 10-99 to the end of a number like e000 that works for both single e0001 and double digits like e0010 instead of the expected result of e00010?
Goal I am looking to add a value to the end of opponent_movefour-e000 before the extension .png that can handle adding 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15.
What I tried If I add a %d on to the end of e000%d I can get the values e0000, e0001, e0002, e0003, e0004, e0005, e0006, e0007, e0008, e0009 which is expected.
self.opponent_movetwoImages = []
for i in range(10):
imgName = "opponentImages/opponent_movefour-e000%d.png" % i
tmpImage = pygame.image.load(imgName)
tmpImage = tmpImage.convert()
transColor = tmpImage.get_at((1, 1))
tmpImage.set_colorkey(transColor)
self.opponent_movefourImages.append(tmpImage)
%d works for numbers 10 or under as expected but what if I need a number 11-20
And I understand that having it as 15 it creates e00010, e00011, e00012, e00013, e00014, e00015
Is there a way to get e0010, e0011, e0012, e0013, e0014, e0015
self.opponent_movefourImages = []
for i in range(15): #needs to be 15
imgName = "opponentImages/opponent_movefour-e000%d.png" % i
tmpImage = pygame.image.load(imgName)
tmpImage = tmpImage.convert()
transColor = tmpImage.get_at((1, 1))
tmpImage.set_colorkey(transColor)
self.opponent_movefourImages.append(tmpImage)
Couldn't open opponentImages/opponent_movefour-e00010.png