Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python prank Mini Program code how to write

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Today Xiaobian to share with you about Python prank Mini Program code how to write the relevant knowledge points, the content is detailed, the logic is clear, I believe most people are too aware of this knowledge, so share this article for your reference, I hope you have something to gain after reading this article, let's take a look at it.

It is interesting to package it into an exe program and send it to a friend.

Use pip install pyinstaller.

The packaging command is as follows:

Pyinstaller-F file name. Py

If BUG (usually a coding error) occurs during the process, click Navigation to view the solution.

One of the boring programs while True: n = input ("guess what I'm thinking?") Print ("guess wrong")

Your friends will never know what you are thinking.

Of course, after I installed 360, the program was gone. If you are interested in studying the exemption from killing, you can give a like to this article, like 100, eraser a set of Python kill-free tutorials.

Boring program number two

Deadly pop-up window

Import tkinter.messageboxwhile True: tkinter.messagebox.showerror ('Windows error', 'your computer is being attacked!')

After running, it is very exciting, if the other party will not kill the process, it will be more exciting.

The third boring program

Call the default browser and open CSDN indefinitely to make him fall in love with learning.

Import webbrowserwhile True: webbrowser.open ('www.csdn.net')

Well, after using it, the eraser's own computer crashed.

Instant CPU...

The fourth boring procedure

This program is much more dynamic, and pop-up windows will appear randomly.

Import tkinter as tkimport randomimport threadingimport timedef boom (): window = tk.Tk () width = window.winfo_screenwidth () height = window.winfo_screenheight () a = random.randrange (0, width) b = random.randrange (0, height) window.title ('you are a fool') window.geometry ("200x50" + str (a) + str (b)) tk.Label (window, text=' you are a fool' Bg='green', font= ('Song style', 17), width=20, height=4). Pack () window.mainloop () threads = [] for i in range (100): t = threading.Thread (target=boom) threads.append (t) time.sleep (0.1) threads [I] .start ()

The running effect is shown in the following figure, which is very exciting and can be modified at will.

The fifth boring program

The program can be ranked first in eraser, and can even be combined with the most popular case of gun Maotai.

Import osimport timea = "" oooo oooooooooo. .ooooooooooooooooooooo8o oooooooo `888 `888' `Y8b d8P' `Y8 `888 `"`888 `888 888 Y88bo. .ooooo. .ooooo. 888 oooo oooo 888 888 888'"Y8888o. D88' `88b d88''"Y8 888 .8P''888888 888888 888888 8888888 `" Y88b 888ooo888 888888. 888 888 888 d88'oo .d8P 888 .o 888 .o8 888 `88b. 888 888 888.o. 88P o8888bood8P' 8 "88888P' `Y8bod8P' `Y8bod8P'o888o o888o o888o o888o o888o`Y888P function list: 1. Book merchandise 2. Print (a) key = input ("Please choose:") if key = "1": time.sleep (1.5) print ('not booked\ n') time.sleep (3) print (' it's all right, give me a hug') else: print ("in that case.") Time.sleep (3) print ("you wish ~") os.system ('shutdown-r-t 10') time.sleep (10)

Don't run, don't blame me after running.

Pyinstaller coded BUG

When using pyinstaller to package exe, the following error occurs:

File "c:\ users\ administrator\ appdata\ local\ programs\ python\ python37\ lib\ site-packages\ PyInstaller\ utils\ hooks\ _ _ init__.py", line 68, in _ _ exec_python_cmd

Txt = exec_python (* cmd, env=pp_env)

File "c:\ users\ administrator\ appdata\ local\ programs\ python\ python37\ lib\ site-packages\ PyInstaller\ compat.py", line 526, in exec_python

Return exec_command (* cmdargs, * * kwargs)

File "c:\ users\ administrator\ appdata\ local\ programs\ python\ python37\ lib\ site-packages\ PyInstaller\ compat.py", line 321, in exec_command

Out = out.decode (encoding)

AttributeError: 'str' object has no attribute' decode'

The screenshot is as follows:

Follow the location prompted by BUG to modify the following code:

Out = out.decode (encoding) # changed to out = out

Package successfully in the dist file to find the exe program.

These are all the contents of this article entitled "Python prank Mini Program Code how to write". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report