python运维自动化脚本案例,python 自动化运维框架

本文介绍了Python在自动化运维中的关键技能,包括Pyautogui用于鼠标键盘控制、Pyautoit结合Autoit实现自动化功能,以及pywinauto进行WindowsGUI自动化。这些模块让Python成为高效运维工具的选择。
摘要由CSDN通过智能技术生成

本篇文章给大家谈谈python自动化运维需要掌握的技能,以及python自动化运维快速入门 pdf,希望对各位有所帮助,不要忘了收藏本站喔。

Source code download: 本文相关源码

大家好,本文将围绕python自动化运维需要掌握的技能展开说明,python自动化运维常用模块是一个很多人都想弄明白的事情,想搞清楚python 自动化运维框架需要先了解以下几个事情。

前言

之前一直使用Autoit3 来实现Windows下的运维及软件安装自动化,但是随着python的普及以及使用Linux的用户群越来越多,Windows下的Autoit3已经有些跟不上时代了,在学习Python的过程中也正巧发现了好几个自动化的python模块可以实现与Aotoit3相同的功能python创意编程比赛作品

安装模块

1、Pyautogui

Pyautogui 可以用Python脚本来控制鼠标和键盘,自动执行应用程序并进行交互工作python基础知识重点。它的API设计非常简单,可在Windows,macOS和Linux上运行,并支持Python 2和3,不依赖任何模块可以直接安装使用。

安装:

pip install pyautogui

相关连接:
Welcome to PyAutoGUI’s documentation! — PyAutoGUI documentation
GitHub - asweigart/pyautogui: A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.

2、Pyautoit

pyautoit 依赖 autoit.dll 实现autoit的各种自动化功能

安装:

pip install -U pyautoit

例子:

#打开记事本
#在记事本中输入“ hello world”
#关闭记事本而不保存

import autoit

autoit.run("notepad.exe") 
autoit.win_wait_active("[CLASS:Notepad]", 3)
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
autoit.win_close("[CLASS:Notepad]")
autoit.control_click("[Class:#32770]", "Button2")

相关连接:
PyAutoIt · PyPI
GitHub - jacexh/pyautoit: Python binding for AutoItX3.dll

3、pywinauto

pywinauto 依赖 pywin32模块,需要先安装pywin32模块

安装:

pip install pywin32
pip install pywinauto

相关连接:

http://pywinauto.github.io/docs/
GitHub - pywinauto/pywinauto: Windows GUI Automation with Python (based on text properties)

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值