Warning: mysqli_query(): MySQL server has gone away in /home/wwwroot/syntaxbug.com/wp-includes/wp-db.php on line 1924

Warning: mysqli_query(): Error reading result set's header in /home/wwwroot/syntaxbug.com/wp-includes/wp-db.php on line 1924
python – SyntaxBug

What channels can Python use to receive orders?

It happened to be Double Eleven some time ago. Usually before and after Double Eleven, there will be a small climax of part-time orders for Python. During this period, the demand for reptiles and data classification in various industries will increase dramatically! Many friends in the circle are busy during weekends, and many of them […]

[Data processing] python Matplotlib partially enlarges the figure; marks the local enlarged subfigure of interest

Foreword In data visualization, it is often necessary to partially enlarge the data in a certain interval to obtain a higher contrast visualization effect. The following uses the Matplotlib library of the Python language to implement a simple partial magnification effect. Dependent libraries matplotlib: plotting library numpy: an extended library that supports a large number […]

[python] Django–templates, static files, django template syntax, requests and responses

The notes are study notes compiled by myself. If there are any mistakes, please point them out~ [Django column] Django–Introduction to Django, installation of Django, creating projects, and getting started quickly Django – templates, static files, django template syntax, requests and responses Django – connect to mysql database Django–templates, static files, django template syntax, requests […]

Python artificial intelligence practice: automatic recommendation system

1. Background introduction Auto Recommendation System (Auto Recommendation System) is a very popular research field in the Internet industry. According to different application scenarios and user needs, its goals can be divided into the following three categories: Personalized recommendation: The system recommends products, articles, etc. that are most relevant to the user’s interests based on […]

What modules in Python do you think are awesome?

The following 10 awesome modules of Python are recommended. For example, the numpy and pandas packages are used for data cleaning. The matplotlib library is used for data visualization. The matplotlib library is easy to get started. For more advanced learning, the seaborn library is an improved chart drawing of the matplotlib library. Method, if […]

Python generates a pair of RSA keys and saves the public and private keys as .pem files respectively. Use the public key in the generated RSA key pair to encrypt the data, and then use the private key to decrypt. Convert RSA’s public key exponent (E) and modulus (N) to .pem format

You can use the cryptography library to generate a pair of RSA keys and save the public and private keys as .pem files respectively. Here is a sample code: from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa # Generate RSA key pair private_key = rsa.generate_private_key( public_exponent=65537, key_size=2048, backend=default_backend() ) # Get […]

How to use python to implement the mail family bucket function

Today I will show you how to implement it without logging into the email interface. The functions of sending emails, adding attachments, and receiving emails are realized through python code. As follows: Use NetEase 126 mailbox for demonstration. You can also add cute photos of young ladies as attachments ? Apply the effect first 1. […]

python exceptions, modules and packages

1. Abnormal Exception: When an error is detected, the Python interpreter cannot continue to execute. Instead, some error prompts appear. This is the so-called “exception”, which is what we often call BUG. 1.1 Catching Exceptions Basic syntax: try: error code may occur except: Code to be executed if an exception occurs Code example: # Try […]

[Python] collections module

The collections module in Python contains some container data types. import collections [x for x in dir(collections) if not x.startswith(‘_’)] # result: [‘ChainMap’, ‘Counter’, ‘OrderedDict’, ‘UserDict’, ‘UserList’, ‘UserString’, ‘abc’, ‘defaultdict’, ‘deque’, ‘namedtuple’] 1. collections.ChainMap() [Search multiple dictionaries] Search multiple dictionaries in the order in which they appear. m=collections.ChainMap(Dictionary 1, Dictionary 2, Dictionary 3,…): manages multiple […]