~~~
import random
def random_color():
# 生成随机颜色值
r = lambda: random.randint(0, 255)
color = f"#{r():02x}{r():02x}{r():02x}"
print(color)
return color
~~~
~~~
import random
def generate_random_color():
return '#{:02x}{:02x}{:02x}'.format(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
print(generate_random_color())
~~~