int function and slice operator
hexColor = '#8060c2'
r = int(hexColor[1:3], 16)
g = int(hexColor[3:5], 16)
b = int(hexColor[5:7], 16)
print(str(r) + ',' + str(g) + ',' + str(b))
hexColor = '#8060c2'
r = int(hexColor[1:3], 16)
g = int(hexColor[3:5], 16)
b = int(hexColor[5:7], 16)
print(str(r) + ',' + str(g) + ',' + str(b))
Leave a Comment
Cancel reply