I have these 3 vertices (end values) of RGB as #ff0000, #ffcfcf and #350000 where R varies from 35 to ff , G from 00 to cf and B from 00 to cf. I need to create a list of all the possible values between them. I did the following: import re my_list=[] for i in xrange(53,256): for j in xrange(0,208): for k in xrange(0,208): item = str(hex(i))+str(hex(j))+str(hex(k)) item2 = re.sub('(0x)','',item) my_list.append(item2) I iterated over the integer values and converted them to hex, followed by concatenating RGB values and replacing 0x from the concatenated string(which doesn't work) . This method is quite slow. Is there a better way to do this? Continue reading...