import re
def FindColor(styleString):
colourRegex = re.compile(r'(color: #)([a-fA-F0-9]{6})')
matchObject = colorRegex.search(styleString)
colorValue = matchObject.group(2) # Isolates the 6-character hex color value
# Do any extra processing here, based on *colorValue*, and create your *use_raw* value. For example:
use_raw = matchObject.group(1) + 'FF0000;'
return use_raw
可以使用正则表达式匹配要查找的字符串类型:
以指定的格式返回任何输入颜色的以下值:
相关问题 更多 >
编程相关推荐