<section id="nice" data-tool="mdnice Editor " data-website="https://www.mdnice.com" style="font-size: 16px; color: black; padding: 0 10px; line-height: 1.6; word-spacing: 0px; letter-spacing: 0px; word-break: break-word; word-wrap: break-word; text-align: left; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;"><p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">Python Can do a lot of boring , But the interesting thing is , For example, the following cases .</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> The following procedure , Don't send the code , Or you can't achieve your trick .</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> It's going to be packaged into a exe Program , It's interesting to send it to friends .</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> Use pip install pyinstaller.</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> The packing order is as follows :</p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">pyinstaller -F file name .py<br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> If there is BUG( It's usually a coding error ), There is a solution at the end of the paper </p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;"> One of the boring programs </strong></p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;"><span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">while</span> True:<br> n = input(<span class="hljs-string" style="color: #98c379; line-height: 26px;">" Guess what I'm thinking ?"</span>)<br> <span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">" Wrong guess "</span>)<br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> Your friends will never know what you're thinking .</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> Of course, I install 360 after , The program is gone. . I'm interested in research on free killing , Like this article , I've praised 100, I'll do it Python No killing tutorial .</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/7e0c1bc51cca45f78967601a70f7be85.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;"> Boring procedure two </strong></p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> The window of death </p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import tkinter.messagebox<br><br><span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">while</span> True:<br> tkinter.messagebox.showerror(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'Windows error '</span>,<span class="hljs-string" style="color: #98c379; line-height: 26px;">' Your computer is being attacked !'</span>)<br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> After running , It's exciting , If they don't kill the process , More exciting .</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://imgkr2.cn-bj.ufileos.com/a53df547-1cf2-4051-89d0-84a39d76db28.png?UCloudPublicKey=TOKEN_8d8b72be-579a-4e83-bfd0-5f6ce1546f13&Signature=p6gkOWvU2S91W8HDVGZYx%252FqbON0%253D&Expires=1614130142" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;"> Boring procedure three </strong></p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> Call the default browser , Infinite open CSDN , Let him fall in love with learning .</p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import webbrowser<br><span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">while</span> True:<br> webbrowser.open(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'www.csdn.net'</span>)<br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> forehead , After use , My own computer crashed .</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/cabe293b984448e5b1f4b94d27ee0124.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> Instantaneous CPU…</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/c3f5f69d01f346b99121d6e12fa84a02.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;"> Boring procedure 4 </strong></p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> This program is much more dynamic , Pop ups will appear randomly .</p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">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(<span class="hljs-string" style="color: #98c379; line-height: 26px;">' You are a fool '</span>)window.geometry(<span class="hljs-string" style="color: #98c379; line-height: 26px;">"200x50"</span> + <span class="hljs-string" style="color: #98c379; line-height: 26px;">"+"</span> + str(a) + <span class="hljs-string" style="color: #98c379; line-height: 26px;">"+"</span> + str(b)) tk.Label(window, text=<span class="hljs-string" style="color: #98c379; line-height: 26px;">' You are a fool '</span>, <span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">bg</span>=<span class="hljs-string" style="color: #98c379; line-height: 26px;">'green'</span>, font=(<span class="hljs-string" style="color: #98c379; line-height: 26px;">' Song style '</span>, 17), width=20, height=4).pack()window.mainloop()threads = []<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">for</span> i <span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span> range(100): t = threading.Thread(target=boom) threads.append(t) time.sleep(0.1) threads[i].start()<br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> The operation effect is shown in the figure below , It's very exciting , It can be modified at will .</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://imgkr2.cn-bj.ufileos.com/4f3d5114-797b-4b46-8a01-b694b07ff5ce.png?UCloudPublicKey=TOKEN_8d8b72be-579a-4e83-bfd0-5f6ce1546f13&Signature=5D%252F5oa5seOXCqdjbGFt7EooVMc0%253D&Expires=1614130215" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"><strong style="font-weight: bold; color: black;"> Boring procedure five </strong></p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> In my opinion, the program can rank first , It can even be combined with the most popular case of gun Maotai at present .</p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">import osimport timea = <span class="hljs-string" style="color: #98c379; line-height: 26px;">""</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">" oooo oooooooooo. .oooooo..o oooo o8o oooo oooo `888 `888' `Y8b d8P' `Y8 `888 `"</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">' `888 `888 888 888 888 Y88bo. .ooooo. .ooooo. 888 oooo oooo 888 888 888 888 888 `"Y8888o. d88'</span> `88b d88<span class="hljs-string" style="color: #98c379; line-height: 26px;">' `"Y8 888 .8P'</span> `888 888 888 888 888 888 8888888 `<span class="hljs-string" style="color: #98c379; line-height: 26px;">"Y88b 888ooo888 888 888888. 888 888 888 888 888 d88' oo .d8P 888 .o 888 .o8 888 `88b. 888 888 888.o. 88P o888bood8P' 8"</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">"88888P' `Y8bod8P' `Y8bod8P' o888o o888o o888o o888o o888o`Y888P Function list :1. Book merchandise 2. Second kill to buy goods "</span><span class="hljs-string" style="color: #98c379; line-height: 26px;">""</span><span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(a)key = input(<span class="hljs-string" style="color: #98c379; line-height: 26px;">" Please select :"</span>)<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">if</span> key == <span class="hljs-string" style="color: #98c379; line-height: 26px;">"1"</span>: time.sleep(1.5) <span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">' No appointment to \n'</span>) time.sleep(3) <span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">' it will be OK , Come and have a hug \n'</span>)<span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">else</span>: <span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">" In that case ..."</span>) time.sleep(3) <span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">print</span>(<span class="hljs-string" style="color: #98c379; line-height: 26px;">" You think it's beautiful ~~~~~"</span>) os.system(<span class="hljs-string" style="color: #98c379; line-height: 26px;">'shutdown -r -t 10'</span>)time.sleep(10)<br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> Don't run , Don't blame me after running .</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;">pyinstaller code BUG</p> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> In the use of pyinstaller package exe When , The following error occurs :</p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;"> File <span class="hljs-string" style="color: #98c379; line-height: 26px;">"c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\utils\hooks\__init__.py"</span>, line 68, <span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span> __exec_python_cmd<br> txt = exec_python(*cmd, env=pp_env)<br> File <span class="hljs-string" style="color: #98c379; line-height: 26px;">"c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\compat.py"</span>, line 526, <span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span> exec_python<br><span class="hljs-built_in" style="color: #e6c07b; line-height: 26px;">return</span> exec_command(*cmdargs, **kwargs)<br> File <span class="hljs-string" style="color: #98c379; line-height: 26px;">"c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\compat.py"</span>, line 321, <span class="hljs-keyword" style="color: #c678dd; line-height: 26px;">in</span> exec_command<br>out = out.decode(encoding)<br>AttributeError: <span class="hljs-string" style="color: #98c379; line-height: 26px;">'str'</span> object has no attribute <span class="hljs-string" style="color: #98c379; line-height: 26px;">'decode'</span><br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> The screenshot is as follows :</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://imgkr2.cn-bj.ufileos.com/dc64b57c-0b00-42ea-a248-6d9f52d1dd5c.png?UCloudPublicKey=TOKEN_8d8b72be-579a-4e83-bfd0-5f6ce1546f13&Signature=NDjThomTbgyi%252Fh230gmR1JkkoKE%253D&Expires=1614130335" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> according to BUG The location of the cue , Modify the following code :</p> <pre class="custom" data-tool="mdnice Editor " style="margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"><span style="display: block; background: url(https://files.mdnice.com/point.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;">out = out.decode(encoding) <span class="hljs-comment" style="color: #5c6370; font-style: italic; line-height: 26px;"># Change it to out = out</span><br></code></pre> <p data-tool="mdnice Editor " style="font-size: 16px; padding-top: 8px; padding-bottom: 8px; margin: 0; line-height: 26px; color: black;"> The success of packing lies in dist Find... In the file exe The procedure is enough .</p> <figure data-tool="mdnice Editor " style="margin: 0; margin-top: 10px; margin-bottom: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center;"><img src="https://static01.imgkr.com/temp/9aba52ec84c842ed8c5b0b2634f0c1d1.png" alt style="display: block; margin: 0 auto; max-width: 100%;"></figure> </section> [ Take it with you !Python 3.9 Official Chinese documents , Time limited collection !] (http://dwz.date/dE6v)
[ Time limit ! Quick collar !14 Zhang HD Python Quick reference table , It is necessary to improve efficiency !] (http://dwz.date/dE6w)
[GitHub Star sign 3W+,80 individual Python Case study , Take you easy to play Python Study !] (http://dwz.date/dE64)