• An undervalued Python data structure named duplex


    Original address:https://miguendes.me/everythi… By Miguel Brito Translator: Dean Wu This article discusses PythonnamedtupleThe key usage of. We will introduce from the simple to the deepnamedtupleThe concept of. You’ll learn why and how to use them, so the code is simpler. After studying this guide, you will love to use it. Learning objectives At the end of […]

  • Python learning notes: data type — number type


    Number type Numerical type, which is usually used to store values, is the most commonly used variable type;The numeric types in Python include the following types:Integer、Long integer、Boolean、Double-precision floating、Complex number。 IntegerPS novice note: many people in the process of learning Python will encounter a variety of vexed questions, no one answers easy to give up. For […]

  • Equivalent connection and natural connection


    1. First of all Tuples: rows in relationships Properties: columns in relationships Relation operation: R (a, B, C, d) and S (B, C, y, z) are two relations; Select [get qualified tuples in relation R] Projection [get some attribute columns in relation R to form a new relation] Join [Select tuples satisfying conditions among attributes […]

  • Common built-in functions for sequence operation of Python sequence (7)


    1. Len (list): returns the number of elements in the list, which is also applicable to tuples, dictionaries, sets, strings, etc. Max, Min: returns the largest or smallest element in a list. The same applies to tuples, dictionaries, collections, range objects, and so on. Sum (list): it is used to sum the elements of the […]

  • Technical practice – PG of PostgreSQL plug-in_ Dirtyread “flashback query”


    Absrtact: Oracle database sometimes accidentally delete the data. If you want to query the data or recover the data, you can use the select statement with as of Clause for flashback query. PG powder is blessed, the following introduces a similar “flashback query” plug-in PG_ Dirtyread, which can read dead data that has not been […]

  • Python learning – tuples


    Tuples are similar to lists, but the biggest difference is that tuples cannot be modified. List creation uses [, tuple creation uses () Tuples are also accessed through subscripts, such as:Create a tuple1 with elements of 1,2,3,4. When we access 3, we use tuple1 [2] as the subscript. Tuples can also be sliced like lists. […]

  • Xlsxwriter operating Excel


    Introduction to xlswriter It is used to write files in Excel 2007 + xlsx file format. Phpspreadsheet supports more formats for reading and writing. advantage Text, number and formula writing, fast, small memory Support such as formatting, images, charts, page settings, automatic filters, conditional formatting and other functions shortcoming Cannot read or modify an existing […]

  • C ා language learning — data types


    data type Sbyte X; // 8bit, signed, represents – 128 ~ 127 Bit X; // 8bit, no sign, 0 ~ 255 Short X; // 16bit, signed integer USHORT X; // 16bit, unsigned integer Int x; // 32bit, signed integer Uint X; // 32bit, unsigned integer Long x; // 64bit, signed integer Ulong X; // 64bit, […]

  • Notes on database system and principle


    Three level model structure Mode, external mode (sub mode), internal mode Two level mapping External schema / schema mapping → guarantee logical independence of data Internal mode / mode influence → guarantee the physical independence of data Introduction to relational database E.f.codd of IBM is the most systematic and strict method to put forward relational […]

  • Mongodb and MySQL single table query


    1. Select several fields in the table db.teacher.find({},{_id:0,name:1}) select name from teacher; 2. Query the tuples that meet the conditions (1) Compare size db.teacher.find({salary : {$gt : 5000}}) select * from teacher where salary > 5000; db.teacher.find({salary : {$gte : 5000}}) select * from teacher where salary >=5000; db.teacher.find({salary : {$lt : 5000}}) select * […]

  • Python connecting MySQL database class


    Python connecting MySQL database class DBHelper.py: import pymysql import logging import sys from mySQL.db_config import db_config #Join log #Get logger instance logger = logging.getLogger(“baseSpider”) #Specify the output format formatter = logging.Formatter(‘%(asctime)s\ %(levelname)-8s:%(message)s’) #File log file_handler = logging.FileHandler(“operation_database.log”) file_handler.setFormatter(formatter) #Console log console_handler = logging.StreamHandler(sys.stdout) console_handler.setFormatter(formatter) #Add specific log processor for logge logger.addHandler(file_handler) logger.addHandler(console_handler) logger.setLevel(logging.INFO) class DBHelper(): […]

  • Script automation shut down host in ZABBIX


    Next, I use Python to shut down the down host in ZABBIX through py ZABBIX API. The basic idea is 1. Obtain the IP of the previous group 2. Check whether the host is down through telnet 3. Turn off the host warningThe python script is very dependent on the connection results of Telnet. If […]