• python | 微信轰炸脚本代码


    一、环境准备

    1、Python3.6

    2、itchat第三方库

    pip install itchat

    3、pyinstaller第三方库

    pip install pyinstaller

    二、核心代码

     

    import itchatimport time

    print("请扫描弹出的扫二维码")itchat.auto_login(hotReload=True)
    boom_name = input("请输入想发送的人:")
    message = input("请输入发送的内容:")
    number = int(input("请输入发送的次数:"))
    boom_obj = itchat.search_friends(remarkName=boom_name)[0]['UserName']
    for i in range(1,number+1):

    time.sleep(0.01)

    print("正在发送第%d遍" %i)

    itchat.send_msg(msg=message,toUserName=boom_obj)

    三、项目打包成可执行文件

    为了方便程序的运行,Python提供了第三方库pyinstaller可以很方便的将项目打包成可执行的exe程序,安装方法:pip install pyinstaller

    1、使用方法:

    -F 选项可以打出一个exe文件,默认是 -D,意思是打成一个文件夹。
    -w 选项可以打桌面程序,去掉命令行黑框

    -i 可以设置图标路径,将图标放在根目录 pyinstaller -F -i cat.ico demo.py
    下载图标:https://www.easyicon.net/

    在这里我们需要打开项目所在的cmd命令框输入:

    pyinstaller -F wechat.py

    等待项目执行完毕即可,此时可执行文件就存在dist文件夹中。

  • 相关阅读:
    整站爬虫命令
    小故事集锦
    中国最经典广告语大全
    常用的正则表达式
    特殊成员方法
    使用super函数----增量重写普通方法和构造方法
    重写普通方法和构造方法------原类的方法会被覆盖
    Python的数据类型与数据结构
    类和对象
    生产者-消费者问题与quene模块
  • 原文地址:https://www.cnblogs.com/huangjiangyong/p/15654596.html
Copyright © 2020-2023  润新知