def random_color(number=number):
color = []
intnum = [str(x) for x in np.arange(10)]
#Out[138]: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
alphabet = [chr(x) for x in (np.arange(6) + ord('A'))]
#Out[139]: ['A', 'B', 'C', 'D', 'E', 'F']
colorArr = np.hstack((intnum, alphabet))
#Out[142]: array(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C','D', 'E', 'F'], dtype='
for j in range(number):
color_single = '#'
for i in range(6):
index = np.random.randint(len(colorArr))
color_single += colorArr[index]
#Out[148]: '#EDAB33'
color.append(color_single)
return color
del color, intnum, alphabet, colorArr, j, i, color_single, index, number
color = random_color(number=6)
#Out[150]: ['#81D4D4', '#70344F', '#DF91B1', '#7EE250', '#C47BC3', '#9F88D5']
ord('a')
97chr(71)
‘G’(np.arange(6) + ord('A'))
Out[158]: array([65, 66, 67, 68, 69, 70])
type((np.arange(6) + ord('A')))
Out[166]: numpy.ndarray
[np.arange(6) + ord('A')]
Out[159]: [array([65, 66, 67, 68, 69, 70])]
type([np.arange(6) + ord('A')])
Out[165]: list