zoukankan      html  css  js  c++  java
  • 零碎知识

    print()
    print(......,end='
    ')
    ****print 自带end=‘
    ’,默认为换行,可以修改end=‘ ’的值。使print不换行
     1 打印进度条
     2 # print('[                 ]')
     3 # print('[##               ]')
     4 # print('[###              ]')
     5 # print('[####             ]')
     6 # print('[#####            ]')
     7 
     8 
     9 # print('[%-50s]' %'#')
    10 # print('[%-50s]' %'##')
    11 # print('[%-50s]' %'###')
    12 
    13 
    14 # 第一个%是取消第二个%号的特殊意义的
    15 # num=30
    16 # print('%s%%' %num)
    17 
    18 
    19 # width=30
    20 # print(('[%%-%ds]' %width) %'#')
    21 # print(('[%%-%ds]' %width) %'##')
    22 # print(('[%%-%ds]' %width) %'###')
    23 
    24 
    25 
    26 #######################################
    27 import time
    28 recv_size = 0
    29 total_size = 100000
    30 
    31 def progress(percent,width=50):
    32     if percent > 1:
    33         percent =1
    34     show_str = ('[%%-%ds]' %width) %(int(width*percent) * '#')
    35     print('
    %s %d%%' %(show_str,int(100*percent)),end = '')
    36 
    37 while recv_size < total_size:
    38     time.sleep(0.2)
    39     recv_size += 8096
    40     percent = recv_size / total_size
    41     progress(percent)
  • 相关阅读:
    1.28
    1.27
    1.26
    如果给你以下功能怎么测试
    测试面试题
    对h5页面的测试方式
    完美解决linux下Django报错Error: That port is already in use.
    KeyError:使用Python的Appium中的“ touchAction” 错误码
    Appium自动化测试
    selenium IDE使用
  • 原文地址:https://www.cnblogs.com/guodengjian/p/8611443.html
Copyright © 2011-2022 走看看