Magic methods and decorators of python class

Decorator Closure decorator The essence of decorator is a closure. There are three elements of closure: 1. Function nesting, 2. External function returns the reference of internal function, and internal function uses the variable of external function 1. Use the decorator to simply realize a login verification function In [1]: user = {"userna ...

Added by Fjerpje on Tue, 08 Feb 2022 14:51:23 +0200

Powerful crawler data analysis tool: Xpath

Official account: Special HouseAuthor: PeterEditor: Peter Hello, I'm Peter~ Before, when the crawler parsed the data, it almost used the regular expression re module to parse the data. Regular parsing data is indeed very powerful, but the expression is very troublesome and sometimes needs to be tried many times; And the speed is relatively ...

Added by Mercenary on Tue, 08 Feb 2022 14:38:08 +0200

[daily] 008_pygame restore push box

   push box can be said to be a very classic puzzle game, and the playing method is also very simple: players only need to control the character to move up, down, left and right to push the box on the map to the specified position, even if it is used as a game to pass customs   because of the simplicity of the playing method, t ...

Added by idotcom on Tue, 08 Feb 2022 14:18:52 +0200

Share the ingenious use skills of Python regular expressions

Transferred from: Micro reading  https://www.weidianyuedu.com Introduction Regular expression is to find rules from strings and express them through "abstract" symbols. For example, for a number sequence such as 2, 5, 10, 17, 26 and 37, how to calculate the seventh value must first find the law of the sequence, and then use the ex ...

Added by urgido on Tue, 08 Feb 2022 13:54:19 +0200

Python project alien invasion (final) record score

Python project alien invasion (final) record score In this chapter, we will end the development of the whole game project. We will add a play button to enable players to start the game by clicking or restart the game after the game is over. At the same time, we will also modify the game to speed up the pace of the game when the player leve ...

Added by davex on Tue, 08 Feb 2022 12:26:44 +0200

Generator & iterator

WeChat official account is searching for the program yuan Xiaozhuang. It pays attention to how to develop a family breadwinner by python. preface String, list, tuple, dictionary and set all belong to iteratable objects. This article will introduce what iteratable objects are. Let's Polish blingbling's big eyes and see together! Iterator ob ...

Added by mu-ziq on Tue, 08 Feb 2022 12:21:47 +0200

Python pyGame to achieve aircraft War-2

Python pyGame to realize aircraft War 1:https://blog.csdn.net/weixin_38778769/article/details/117329303 Continue the previous one. The previous one talked about adding game frames, game backgrounds, and the movement of players' planes The purpose of this tutorial is to generate enemy aircraft, the movement of enemy aircraft, the destruction a ...

Added by motofzr1000 on Tue, 08 Feb 2022 12:17:38 +0200

Study notes 06--@tf function

TensorFlow 2's default Eagle execution mode brings us flexibility and easy debugging. However, in order to pursue faster speed and higher performance, we still want to use tensorflow 1 The default Graph Execution mode in X. At this point, TensorFlow 2 provides us with TF Function module, combined with AutoGraph mechanism, makes us only need to ...

Added by CrowderSoup on Tue, 08 Feb 2022 09:39:29 +0200

Scratch learning - climb to the fund list of Tiantian Fund Network

describe Crawling http://fundact.eastmoney.com/banner/pg.html#ln Data from the website, Requirements: crawl the fund code, fund name, unit net worth, date, daily growth rate, recent week, recent January, recent March, recent June, recent year, recent two years, recent three years, this year, since its establishment and handling fee of all fund ...

Added by farzal on Tue, 08 Feb 2022 09:24:15 +0200

Using python to realize wechat automatic reply, group sending and other operations (no need to log in to wechat on the web)

At present, wechat web version restricts login, and the means of operating wechat by wxpy and other modules can not be used. WechatPCAPI module was found a while ago. Wechat is operated by means of dll injection. Here is how to use this module. Operating environment The WechatPCAPI module still has strict requirements for the running environm ...

Added by Hatdrawn on Tue, 08 Feb 2022 06:55:34 +0200