I am trying:
mycolor= "240,240,240" mycolor= webcolors.rgb_to_name ((mycolor))
But nothing comes of it.
What could be the reason?
Answer # 1
webcolors.rgb_to_name ()expects a tuple with three integers as input, and you feed it a string as input.
mycolor= (240,240,240) mycolor= webcolors.rgb_to_name (mycolor)
If your color is initially set as string , then it can be parsed:
from ast import literal_eval mycolor= "240,240,240" if isinstance (mycolor, str): mycolor= literal_eval (mycolor) mycolor= webcolors.rgb_to_name (mycolor)
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable