zoukankan      html  css  js  c++  java
  • 剑指加载小尾部

    核心思路

      1. 去掉print输出函数后面的默认换行为需要的符号
      2. 通过for循环重复输出
      4. 通过 退格符  清空已经输出的字符 或 通过 回到行首重新从当前输出
      5. 通过随机函数random和时间函数sleep控制输出间隔

    # --|/ 加载页面
    import time
    import random
    
    
    def load_ui():
        ui_char = ["--", "\", "|", "/"]
        while True:
            for item in ui_char:
                print(item, end="")
                time.sleep(.4)
                print("
    ", end="")
    
    
    # ... 加载页面=
    def load_ui_dot():
        prompt = "."
        while True:
            for item in range(3):
                print(prompt, end="")
                time.sleep(.8)
                if item == 2:
                    print("
    ", end="")
    
    
    def load_ui_process():
        # 进度的提示符
        prompt = "#"
        head_show = "{}% "
        for i in range(10+1):
            print(head_show.format(i * 10) + ''.center(i, prompt), end="")
            time.sleep(random.random())
            print("
    ", end="")
    
    
    if __name__ == "__main__":
        load_ui()
        pass
    

      

  • 相关阅读:
    将图片保存到数据库中及转换
    svn 插件地址
    反射
    android 使用Sax 读取xml
    抓取 网页信息
    客户端测试
    简单多线程+委托+事件
    postman实战四
    Postman练习
    Jmeter练习二添加书籍信息
  • 原文地址:https://www.cnblogs.com/2bjiujiu/p/13759065.html
Copyright © 2011-2022 走看看