python里面向shell输出彩色字符串,pythonshell输出,shell里面显示字符串
python里面向shell输出彩色字符串,pythonshell输出,shell里面显示字符串
shell里面显示字符串有时候是彩色的,python的print也可以实现相同的输出
testShellColor.py
#!/usr/bin/env python#-*-coding:utf-8-*-#Filename:__author__ = "maqiang.jacky <maqiang.jacky@snda.com>"__version__ = 1.0__date__ = "12-2-9""""0 All attributes off 默认值1 Bold (or Bright) 粗体 or 高亮4 Underline 下划线5 Blink 闪烁7 Invert 反显30 Black text31 Red text32 Green text33 Yellow text34 Blue text35 Purple text36 Cyan text37 White text40 Black background41 Red background42 Green background43 Yellow background44 Blue background45 Purple background46 Cyan background47 White background"""def main(): """ """for atrr in [0,1,4,5,7]: print "attribute %d ------------------------------" % atrr for fore in [30,31,32,33,34,35,36,37]: for back in [40,41,42,43,44,45,46,47]: color = "\x1B[%d;%d;%dm" % (atrr,fore,back) print "%s %d-%d-%d\x1B[0m" % (color,atrr,fore,back), print ""if __name__ == "__main__": """ """ main()
相关内容
- python替换html中的空标签,python替换html标签,html中的空行
- 数独人工算法的python实现,人工算法python,目前只有两个
- python使用os.path和hashlib遍历目录计算所有文件的md5值,
- python过滤字符串中不属于指定集合的字符的类,python字
- python清空linux/unix系统共享内存代码,pythonunix,# -*- cod
- python使用蒙特卡洛方法计算圆周率,python蒙特卡洛,蒙特
- UnicodeDecodeError: 'utf8' codec can't decode
- Python读取浮点数|读文本文件,python点数,[Python]代码im
- python调用摄像头摄像并保存图片,,[Python]代码#!
- python 监控 linux cpu 使用率,pythonlinux,[Python]代码
评论关闭