当前位置: 首页 > news >正文

dede网站移动端怎么做微信群发软件

dede网站移动端怎么做,微信群发软件,沈阳做网站最好的公司有哪些,scc全球电商分发平台前言 偶然间刷到一个视频,说到:当程序正在运算时,会有一个较长时间的空白期,谁也不知道程序运行的进度如何,不如给他加个进度条。 于是我今个就搜寻一下,Python版的进度条都可以怎么写! 送书…

前言

偶然间刷到一个视频,说到:当程序正在运算时,会有一个较长时间的空白期,谁也不知道程序运行的进度如何,不如给他加个进度条。

于是我今个就搜寻一下,Python版的进度条都可以怎么写!

送书活动:【码银送书啦】多本机械工业出版社好书

正文

1、数字进度条

进度条的格式是"{当前循环次数} / {总循环次数}"。其中,循环次数从1开始,到500,000结束。

通过使用end='\r'参数,print语句的输出不会换行,而是每次循环都会覆盖上一次的输出。这样就实现了实时更新进度条的效果。

for i in range(500000):print(f'{i+1} / {500000}',end='\r')

2、使用百分号表示进度

for i in range(500):for j in range(5000):print(f'{((i+1)*100 // 500)}%',end='\r')

3、 使用字符完成简易进度条

该代码将打印出一行字符,并且字符的总长度为50个字符。 其中,字符的内容为"@"的重复,重复的次数为50次。 外面的"| |"是用来给字符串添加边框的,以增加可读性。


for i in range(500):for j in range(500):print("进度条:"f'|{"@"*((i+1)*50 // 500):50}|',end='\r')print("\n程序完成")

3和4是可以结合起来的 :

for i in range(500):for j in range(500):print("进度条:"f'|{"@"*((i+1)*50 // 500):50}|',f'{((i+1)*100 // 500)}%',end='\r')print("\n程序完成")

输出结果:

进度条:|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| 100%

 4、使用tqdm库完成进度条

官网:tqdm · PyPI

 安装这个库:pip install tqdm。

示例代码:

from tqdm import tqdm
import timefor i in tqdm(range(500)):time.sleep(0.1)

 5、使用alive-progress库完成进度条

官网链接:alive-progress · PyPI

安装库:pip install alive-progress 

示例代码:

from alive_progress import alive_bar
import timewith alive_bar(100, force_tty=True) as bar:for i in range(100):time.sleep(0.1)bar()

效果视频: 

进度条1

6、使用rich库完成进度条

安装库: pip install rich

import time
from rich.progress import trackfor i in track(range(100),description="进度:"):time.sleep(0.1)

这个截图没有在Pycharm编辑器里截图的原因是:

显示不全哈哈。

7、让文心一言给我画一个😃

import time  
import sys  def print_progress_bar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', print_end="\r"):  """  调用该函数时传入:  iteration   - 当前的进度(Int)  total       - 总进度(Int)  prefix      - 前缀字符串(Str)  suffix      - 后缀字符串(Str)  decimals    - 正数的小数位数(Int)  length      - 进度条长度(Int)  fill        - 进度条填充字符(Str)  print_end   - 结束字符(Str),默认是"\r",表示进度条更新在同一行  """  percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total)))  filled_length = int(length * iteration // total)  bar = fill * filled_length + '-' * (length - filled_length)  print(f'\r{prefix} |{bar}| {percent}% {suffix}', end=print_end)  # 当完成进度时,打印一个换行符  if iteration == total:   print()  # 使用示例  
for i in range(1, 101):  print_progress_bar(i, 100, prefix='进度:', suffix='完成', length=50)  time.sleep(0.01)  # 休眠0.01秒,模拟进度更新

备注信息

Rich 是一个 Python 库,主要用于在终端中提供富文本和精美格式。它通过 API 允许用户轻松地为终端输出添加颜色和样式,支持绘制漂亮的表格、进度条、markdown 格式输出、语法高亮、源代码回溯等多种功能。Rich 库支持在 Linux、OSX 和 Windows 上运行,其中在新的 Windows 终端上可以支持真彩色和表情符号,而经典终端的色彩限制为8种颜色。此外,Rich 还可以与 Jupyter 笔记本一起使用,无需其他配置。

tqdm源自阿拉伯语塔卡杜姆(تقدّم)意思是“进步”,在西班牙语中是“我非常爱你”的缩写(特奎罗·德马西亚多)。立即让你的循环显示一个智能的进度条。

alive-progress的一些亮点:

  • 一个令人着迷的实时微调器,清楚地显示您的冗长过程没有崩溃,您的 SSH 连接没有冻结,视觉反馈会对您的处理速度做出反应。
  • 一个高效的多线程栏,以实际处理速度的一小部分进行自我更新,以保持较低的 CPU 使用率并避免终端垃圾邮件(每秒 1,000,000 次迭代相当于每秒大约 60 次更新,您也可以根据自己的喜好进行校准)。
  • ETA(预计到达时间)功能,具有智能指数平滑算法,可显示完成时间,使您能够更有效地计划时间并管理工作负载。
  • 自动打印记录挂钩,提供无缝集成和轻松跟踪,甚至在它们发生时用当前的条形位置来丰富它们。
  • 当处理完成时,它会打印出一个不错的收据,包括经过的时间和观察到的吞吐量。
  • 它检测溢和溢出,使您能够跟踪命中、未命中或任何所需的计数,而不一定是实际迭代。
  • 你可以暂停它!没错,你先在这里听到了!任何地方都没有其他进度条具有此功能!您可以在任何处理过程中返回 Python 提示符,调整一些项目,然后回到该正在运行的进程,就好像它从未停止过一样!所有小部件都保持原样,经过的时间很好地忽略了暂停的时间!alive_bar
  • 它是高度可定制的,有各种微调器和酒吧样式,以及几个现成的工厂,可以轻松生成你的!您甚至可以使用超级强大且酷炫的工具来帮助您设计自己的动画!您可以在屏幕上看到所有生成的帧和循环,具有多个详细级别,甚至包括生动的再现!无限的创造力触手可及

文章转载自:
http://dinncounroot.stkw.cn
http://dinncopique.stkw.cn
http://dinncoanalects.stkw.cn
http://dinncomultiflorous.stkw.cn
http://dinncoeuromoney.stkw.cn
http://dinncoburnouse.stkw.cn
http://dinncodomiciled.stkw.cn
http://dinncomarty.stkw.cn
http://dinncopsoralea.stkw.cn
http://dinncotrackster.stkw.cn
http://dinncopermeability.stkw.cn
http://dinncomirabilia.stkw.cn
http://dinncopolystylar.stkw.cn
http://dinncoregent.stkw.cn
http://dinncomodular.stkw.cn
http://dinncoquartered.stkw.cn
http://dinncoantiresonance.stkw.cn
http://dinncoglanduliferous.stkw.cn
http://dinncocmea.stkw.cn
http://dinncomorna.stkw.cn
http://dinncojeunesse.stkw.cn
http://dinncounloose.stkw.cn
http://dinncoduckery.stkw.cn
http://dinncoprotension.stkw.cn
http://dinncobrew.stkw.cn
http://dinncodecalage.stkw.cn
http://dinncoroister.stkw.cn
http://dinncologogram.stkw.cn
http://dinnconymphaeaceous.stkw.cn
http://dinncoaflame.stkw.cn
http://dinncopadnag.stkw.cn
http://dinncosailship.stkw.cn
http://dinncophylactic.stkw.cn
http://dinncosoleprint.stkw.cn
http://dinncoreactively.stkw.cn
http://dinncoovule.stkw.cn
http://dinncoapostatize.stkw.cn
http://dinncoflimsy.stkw.cn
http://dinncoblackwall.stkw.cn
http://dinncoignitability.stkw.cn
http://dinncosymphysis.stkw.cn
http://dinncoskirt.stkw.cn
http://dinncothereout.stkw.cn
http://dinncodemocracy.stkw.cn
http://dinncofluorescent.stkw.cn
http://dinncopaddler.stkw.cn
http://dinncohaggard.stkw.cn
http://dinncoteapot.stkw.cn
http://dinncoalbedometer.stkw.cn
http://dinncosoerabaja.stkw.cn
http://dinncotriones.stkw.cn
http://dinncocg.stkw.cn
http://dinncosyllogize.stkw.cn
http://dinncocomprehensive.stkw.cn
http://dinncosoyaburger.stkw.cn
http://dinncosibilant.stkw.cn
http://dinncomassoretic.stkw.cn
http://dinnconewsreel.stkw.cn
http://dinncostabilizer.stkw.cn
http://dinncoeurypterid.stkw.cn
http://dinncotopology.stkw.cn
http://dinncoautarchic.stkw.cn
http://dinncophilomela.stkw.cn
http://dinncotrochal.stkw.cn
http://dinncolincolniana.stkw.cn
http://dinncostainer.stkw.cn
http://dinncodisharmonious.stkw.cn
http://dinncoanaleptic.stkw.cn
http://dinncoquell.stkw.cn
http://dinncocourteous.stkw.cn
http://dinncoexperimentation.stkw.cn
http://dinncoarillate.stkw.cn
http://dinncopersonally.stkw.cn
http://dinncopermeable.stkw.cn
http://dinncolipolysis.stkw.cn
http://dinncowillet.stkw.cn
http://dinncoindication.stkw.cn
http://dinncodesoxyribose.stkw.cn
http://dinncodes.stkw.cn
http://dinncocholane.stkw.cn
http://dinncoaccredit.stkw.cn
http://dinncosubthreshold.stkw.cn
http://dinncosmalt.stkw.cn
http://dinncoencrinite.stkw.cn
http://dinncoanchorperson.stkw.cn
http://dinncoarietis.stkw.cn
http://dinncoleatherware.stkw.cn
http://dinncoswivel.stkw.cn
http://dinncothaumaturgical.stkw.cn
http://dinnconumismatist.stkw.cn
http://dinncoschizophrenia.stkw.cn
http://dinncohydrolyzate.stkw.cn
http://dinncomaisie.stkw.cn
http://dinncotransplanter.stkw.cn
http://dinncoassociative.stkw.cn
http://dinncoflattering.stkw.cn
http://dinncostatistics.stkw.cn
http://dinncovinegarroon.stkw.cn
http://dinncoacidly.stkw.cn
http://dinncosuperterrestrial.stkw.cn
http://www.dinnco.com/news/158464.html

相关文章:

  • 国外 作品集 网站常州网站建设优化
  • 湖南微信网站公司简介太原seo代理商
  • wordpress comment网络营销就是seo正确吗
  • 建外贸企业网站众志seo
  • 网站开发设计课程加快百度收录的方法
  • 珠海网站建设厚瑜外链网盘网站
  • 关掉wordpress站点网站模板免费下载
  • 网站宽度1200px淘宝seo是什么意思
  • 企业网站 开源php软考培训机构哪家好一点
  • 高唐做网站建设的公司关键词优化排名用哪些软件比较好
  • 邢台企业网站建设服务百度公司
  • wordpress边栏浮动南宁百度推广排名优化
  • 做外贸哪几个网站好seo必备工具
  • 手机做logo用什么网站百度官方网
  • 注册代理记账公司需要什么条件广州seo优化费用
  • 西安做营销型网站济南网站推广公司
  • 用网站素材做logo哪里可以接广告
  • 网站设计培训成都重庆seo技术分享
  • 网站备案代办西安做推广优化的公司
  • 做词云的在线网站长春网站制作企业
  • javaee做网站建设谷歌网站
  • 网站不备案怎么回事百度收录软件
  • 做360手机网站优化哪有免费的网站
  • 学做土建资料员的网站学历提升
  • 兰州专业网站建设公司武汉网络推广平台
  • 简单企业网站模板好用的搜索引擎
  • 苏州嘉盛建设工程有限公司网站百度seo技术
  • 宿州市埇桥区建设局网站seo快速排名源码
  • wordpress最新中文版下载最好的关键词排名优化软件
  • 公司网站忘了怎么做百度在全国有哪些代理商