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

护肤品网站建设目的职业资格证培训机构加盟

护肤品网站建设目的,职业资格证培训机构加盟,上海网站设计制作报价,o2o模式的电商平台网站有哪些10个杀手级应用的Python自动化脚本 重复的任务总是耗费时间和枯燥的。想象一下#xff0c;逐一裁剪100张照片#xff0c;或者做诸如Fetching APIs、纠正拼写和语法等任务#xff0c;所有这些都需要大量的时间。为什么不把它们自动化呢#xff1f;在今天的文章中#xff0c…10个杀手级应用的Python自动化脚本 重复的任务总是耗费时间和枯燥的。想象一下逐一裁剪100张照片或者做诸如Fetching APIs、纠正拼写和语法等任务所有这些都需要大量的时间。为什么不把它们自动化呢在今天的文章中我将与你分享10个Python自动化脚本。 所以请把这篇文章保留在你的书签里供以后参考。在IT行业程序员永远不会停止学习...... 现在让我们开始吧。 01、图像优化器 这个伟大的自动化脚本可以帮助你更好地处理图片你可以像在Photoshop中一样编辑它们。 该脚本使用流行的Pillow模块。 # 图像优化# pip install Pillowimport PIL# 裁剪 im  PIL.Image.open(Image1.jpg)im  im.crop((34, 23, 100, 100))# 调整大小im  PIL.Image.open(Image1.jpg)im  im.resize((50, 50))# 翻转im  PIL.Image.open(Image1.jpg)im  im.transpose(PIL.Image.FLIP_LEFT_RIGHT)# 旋转im  PIL.Image.open(Image1.jpg)im  im.rotate(360)# 压缩im  PIL.Image.open(Image1.jpg)im.save(Image1.jpg, optimizeTrue, quality90)# 模糊化im  PIL.Image.open(Image1.jpg)im  im.filter(PIL.ImageFilter.BLUR)# 锐化im  PIL.Image.open(Image1.jpg)im  im.filter(PIL.ImageFilter.SHARPEN)# 设置亮度im  PIL.Image.open(Image1.jpg)im  PIL.ImageEnhance.Brightness(im)im  im.enhance(1.5)# 设置对比度im  PIL.Image.open(Image1.jpg)im  PIL.ImageEnhance.Contrast(im)im  im.enhance(1.5)# 添加过滤器im  PIL.Image.open(Image1.jpg)im  PIL.ImageOps.grayscale(im)im  PIL.ImageOps.invert(im)im  PIL.ImageOps. posterize(im, 4)# 保存im.save(Image1.jpg) 02、视频优化器 通过下面的自动化脚本你不仅可以用Python来优化视频还可以用它来优化图像。该脚本使用Moviepy模块它允许你修剪、添加音频、设置视频速度、添加VFX等。 # 视频优化器# pip install moviepyimport moviepy.editor as pyedit# 加载视频video  pyedit.VideoFileClip(vid.mp4)# 修剪vid1  video.subclip(0, 10)vid2  video.subclip(20, 40)final_vid  pyedit.concatenate_videoclips([vid1, vid2])# 加快视频的速度final_vid  final_vid.speedx(2)# 在视频中添加音频aud  pyedit.AudioFileClip(bg.mp3)final_vid  final_vid.set_audio(aud)# 反转视频final_vid  final_vid.fx(pyedit.vfx.time_mirror)# 合并两个视频vid1  pyedit.VideoFileClip(vid1.mp4)vid2  pyedit.VideoFileClip(vid2.mp4)final_vid  pyedit.concatenate_videoclips([vid1, vid2])# 在视频中添加视觉特效vid1  final_vid.fx(pyedit.vfx.mirror_x)vid2  final_vid.fx(pyedit.vfx.invert_colors)final_vid  pyedit.concatenate_videoclips([vid1, vid2])# 在视频中添加图像img1  pyedit.ImageClip(img1.jpg)img2  pyedit.ImageClip(img2.jpg)final_vid  pyedit.concatenate_videoclips([img1, img2])# 保存视频final_vid.write_videofile(final.mp4) 03、将PDF转换为图像 这个小的自动化脚本可以很容易地检索整个PDF页面并将其转换为图像。该脚本使用了流行的PyMuPDF模块该模块以其PDF文本提取而闻名。 # PDF to Images# pip install PyMuPDFimport fitzdef pdf_to_images(pdf_file):    doc  fitz.open(pdf_file)    for p in doc:        pix  p.get_pixmap()        output  f page{p.number}.png        pix.writePNG(output)pdf_to_images(test.pdf) 04、获取API数据 如果你需要从数据库中获取API数据或者需要向服务器发送API请求这个自动化脚本是你的一个便利工具。使用Urlib3模块你可以获取和发布API请求。 # pip install urllib3输入urllib3# 获取API数据url  https://api.github.com/users/psf/reposhttp  urllib3.PoolManager()response  http.request(GET, url)print(response.status)print(response.data)# 发布API数据url  https://httpbin.org/posthttp  urllib3.PoolManager()response  http.request(POST, url, fields{hello: world})print(response.status) 05、电池指示灯 这个方便的脚本允许你设置你想接收通知的电池百分比。该脚本使用Pyler进行通知并使用Psutil来获取当前的电池百分比。 # 电池通知器# pip instal plyerfrom plyer import notificationimport psutilfrom time import sleepwhile True:   battery  psutil.sensors_battery()    life  battery.percent    #寿命  电池百分比    if life  50:        notification.notify(            title  Battery Low #电池电量不足            message  Please connect to power source,            timeout  10        )    sleep(60)  06、语法修正器 厌倦了校对你的长篇文章或文本那么你可以试试这个自动脚本它将扫描你的文本并纠正语法错误。这个伟大的脚本使用了Happtransformer模块它是一个机器学习模块经过训练可以修正文本中的语法错误。 # Grammer Fixer# pip install happytransformerfrom happytransformer import HappyTextToText as HappyTTTfrom happytransformer import TTSettingsdef Grammer_Fixer(Text):    Grammer  HappyTTT(T5,prithivida/grammar_error_correcter_v1)    config  TTSettings(do_sampleTrue, top_k10, max_length100)    corrected  Grammer.generate_text(Text, argsconfig)    print(Corrected Text: , corrected.text)Text  This is smple tet we how know thisGrammer_Fixer(Text) 07、拼写纠正 这个伟大的脚本将帮助你纠正文本单词中的拼写错误。你可以找到下面的脚本它将告诉你如何修正一个句子中的单个或多个单词。 # 拼写修正器# pip 安装 textblob# pip install textblobfrom textblob import *def fix_paragraph_words(paragraph):    sentence  TextBlob(paragraph)    correction  sentence.correct()    print(correction)# 修复字词拼写def fix_word_spell(word):    word  Word(word)    更正  word.correct()    print(correction)fix_paragraph_words(this is sammple tet!!)fix_word_spell(maangoo) 08、互联网下载器 你可能使用下载软件从互联网上下载照片或视频但现在你可以使用Python IDM模块创建自己的下载器。 # Python Downloader# pip install internetdownloadmanagerimport internetdownloadmanager as idmdef Downloader(url, output):    pydownloader  idm.Downloader(worker20,                                part_size1024*1024*10,                                resumableTrue,)    pydownloader .download(url, output)Downloader(Link url, image.jpg)Downloader(Link url, video.mp4) 09、获取世界新闻 使用这个自动脚本可以随时以任何国家/地区的任何语言更新每日的世界新闻。这个API允许你每天免费获得50条新闻。 # pip install requestsimport requestsApiKey  YOUR_API_KEYurl  https://api.worldnewsapi.com/search-news?texthurricaneapi-key{ApiKey}headers  {  Accept: application/json}response  requests.get(url, headersheaders)print(News: , response.json()) 10、PySide2 GUI 这个自动化脚本将帮助你使用PySide2 Gui模块创建你的GUI应用程序。你可以在下面找到开始开发现代应用程序的前端所需的每一种方法。 # PySide2 # pip install PySide2from PySide6.QtWidgets import *from PySide6.QtGui import *app  QApplication(sys.argv)window  QWidget()# 调整窗口的大小window.resize(500, 500)# 设置窗口标题window.setWindowTitle(PySide2 Window)# 添加按钮button  QPushButton(Click Me, window)button.move(200, 200)# 添加标签文本label  QLabel(Hello Medium, window)label.move(200, 150)# 添加输入框input_box  QLineEdit(window)input_box.move(200, 250)print(input_box.text())# 添加单选按钮radio_button  QRadioButton(Radio Button, window)radio_button.move(200, 300)# 添加复选框checkbox  QCheckBox(Checkbox, window)checkbox.move(200, 350)# 添加滑块slider  QSlider(window)slider.move(200, 400)# 添加进度条progress_bar  QProgressBar(window)progress_bar.move(200, 450)# 添加图片 image  QLabel(window)image.setPixmap(QPixmap(image.png))# 添加消息框msg  QMessageBox(window)msg.setText(Message Box)msg.setStandardButtons(QMessageBox.OK | QMessageBox.Cancel)window.show()sys.exit(app.exec()) 好了今天的分享就到这里。如果你喜欢它请给它一个赞~。 本文由 mdnice 多平台发布
http://www.dnsts.com.cn/news/262070.html

相关文章:

  • 百度seo 站长工具怎样跟网站做优化呢
  • 嘉瑞建设集团有限公司网站php网站设计
  • 网站管理助手 二级域名360企业网站认证
  • 专门做本子的网站外贸导向企业网站
  • oracle数据库做的网站帝国做企业网站
  • phpcms做视频网站首页wordpress新闻插件
  • 企业为什么做企业网站和推广成都网站设计定制
  • 中企动力网站建设 医疗建设部网站查询造价师证件
  • 房产网站怎么建设做网站和网站维护需要多少钱
  • 提供中小企业网站建设江阴网站建设多少钱
  • 十堰网站搜索优化价格wordpress文章图片自动下载
  • 寻找电子商务网站建设网站点
  • 网站图片动态换名兰州网站seo优化
  • 网站 后台 安装重庆制作网站培训机构
  • 网站建设都用那些软件vi设计包含什么
  • 品牌推广网站策划设计开发网站用什么语言
  • 网站建设模块下载网站技术支持
  • 义乌建设局网站wordpress the field
  • 做网站网页的人是不是思维整合式营销
  • 好看的网站你明白的大连市城乡建设厅网站
  • 济南网站建设老威app定制开发哪家公司强
  • 网站降权怎么做天津手机版建站系统哪个好
  • 深圳网站建设认准乐云品牌网站建设维护
  • 网站幻灯通栏代码photoshop手机版下载官网
  • 南通做网站价格北京网站设计建设
  • 登录企业网站管理系统服装设计公司简介范文
  • 网站改不了分类不安装word使用wordpress
  • 网站自动屏蔽恶意点击高端网吧电脑配置
  • 建网站有什么用ui设计一个页面多少钱
  • 做电影网站收入o2o网站建设代理商