简体   繁体   中英

how to find a color representation string in a string in python?

example:

col_str = 'South Shore Lily Rose 4 Drawer Chest in White Wash'

I want to take white alone, we should not hard-code the color string by default it has to identify, how to do this?

As you have tagged question with wxpython ,I am assuming that you have wxpython and the below code should be useful for you:

import wx.lib.colourdb as wb
col_str = 'South Shore Lily Rose 4 Drawer Chest in White Wash'
colr = wb.getColourList()
for x in col_str.split(" "):
    if(x.upper() in colr):
        print(x)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM