ColorCodes = {
‘black‘ : ‘0;30‘,
‘blue‘ : ‘0;34‘,
‘bright blue‘ : ‘1;34‘,
‘bright cyan‘ : ‘1;36‘,
‘bright gray‘ : ‘0;37‘,
‘bright green‘ : ‘1;32‘,
‘bright purple‘ : ‘1;35‘,
‘bright red‘ : ‘1;31‘,
‘bright yellow‘ : ‘1;33‘,
‘cyan‘ : ‘0;36‘,
‘dark gray‘ : ‘1;30‘,
‘green‘ : ‘0;32‘,
‘purple‘ : ‘0;35‘,
‘red‘ : ‘0;31‘,
‘white‘ : ‘1;37‘,
‘yellow‘ : ‘0;33‘,
‘normal‘ : ‘0‘
}
ans = raw_input("\033[" + ColorCodes[‘red‘] + "m" + ‘yes or no ? :‘ + "\033[0m")
效果如下:
时间: 2024-11-07 23:46:12