[Python]:一句话将RGB颜色转换成HEX码
#-*- coding: utf-8 -*- # yankchina@gmail.com 2009-11-03 # 将RGB码转换成HEX码,用于CSS编程 defRGB2HEX( Red, Green, Blue ): HEX ="%s%s%s"% (hex( Red )[-2:],hex( Green )[-2:],hex( Blue )[-2:] ) Return HEX defR2H( Red,Green,Blue ): Print Red,Green,Blue,":",RGB2HEX(Red,Green,Blue)