zoukankan      html  css  js  c++  java
  • Python小知识点

    #!/usr/bin/env python
    # -*- coding:utf-8 -*-
    import sys
    choice = input("是否退出?")
    if  choice == 'Y' or choice == 'y':
        exit('成功退出了')#这里面还可以输出内容,很好玩
    #!/usr/bin/env python
    # -*- coding:utf-8 -*-
    import sys,time
    for i in range(100):
        sys.stdout.write('#')      #python打印进度条,python2.7可用
        time.sleep(0.3)

     

    #!/usr/bin/env python
    # -*- coding:utf-8 -*-
    import sys,time
    '''
    Python打印进度条,比较美观
    '''
    for i in range(31):
        sys.stdout.write('
    ')  #每一次清空原行
        sys.stdout.write('%s%% |%s' %((int(i/30*100), int(i/30*100)*'*')))
        sys.stdout.flush()  #强制刷新到屏幕
        time.sleep(0.3)

     

  • 相关阅读:
    全局变量 和 局部变量
    函数
    字符串拼接
    集合
    字典
    元祖
    列表
    Python 字符串 小练习
    ssm多数据源配置
    JAVA笔记:double四舍五入并保留两位小数的方法
  • 原文地址:https://www.cnblogs.com/yigongzi/p/9660923.html
Copyright © 2011-2022 走看看