用Python写a穿过#
来源:互联网 发布:linux卸载httpd服务 编辑:程序博客网 时间:2024/06/06 05:02
可以实现的功能是字符a动态穿越了 20个#
展现的是
- sys.stdout.write(),和print类似,但是不会换行
- \r覆盖打印
- sys.stdout.flush()写入硬盘,不然sys.stdout.write()只会写入缓存,看不到输出
- 异常捕获。当程序在sleep(0.5)的时候,捕获到ctl+c键盘终端,不打印错误信息退出
#!/usr/bin/env pythonimport timeimport syssys.stdout.write('\r'+ '#'*20)sys.stdout.flush()count = 0while True: sys.stdout.write('\r'+ '#' * count + 'a') sys.stdout.flush() count += 1 try: time.sleep(0.5) except KeyboardInterrupt: print '\nexit' break if count == 20: sys.stdout.write('\r'+'#' * 20) sys.stdout.flush() count = 0
0 0
- 用Python写a穿过#
- Python写反斜杠\a
- unity中开启物理效果时,用A方块击打B方块,A会直接穿过B(当速度比较大时)
- 用 Python写 daemon
- 用python写exploit
- 用python写游戏
- 用python写爬虫
- 用Python写Exploit
- 用 Python写 daemon
- 用python写makefile
- 用python写makefile
- 用python写pintool
- STUN—简单地用UDP穿过NAT
- 穿过撒哈拉
- 穿过防火墙
- 穿过街道
- 找出穿过最多点的直线 Max Points on a Line
- 用python写ASP脚本
- dubbo学习笔记 六 dubbo-container
- openwrt添加本地镜像地址
- caffe常用层的参数设置说明
- layer插件的初始化
- 初步学习使用msysgit基本操作以及上传项目到GitHub
- 用Python写a穿过#
- 欢迎使用CSDN-markdown编辑器
- MySQL数据库的21中优化方法,(以供学习)
- SQL优化总结
- js创建对象
- @Responsebody与@RequestBody
- BootStrap--CSS组件--标签(label)
- Android通用流行框架大全
- HTML5工作技能与就业薪酬范围划分