Use Python to read the Nginx log and write the required information to the database.

#!/usr/bin/env python# coding:utf-8# auther:liangkai# date:2018/6/26 11:26# License: (C) Copyright 2013-2017, Node Supply Chain Manager Corporation limited.# describe:import pymysqlimport reimport datetime# DB variablesdbhost = "192.168.189.18 5

Python Socket Instance Practice

Simple socket CommunicationServerImport socketsock_server = Socket.socket (socket.af_inet, socket. SOCK_STREAM) sock_server.setsockopt (socket. Sol_socket, SOCKET. SO_REUSEADDR, 1) # Reuse Address Port Sock_server.bind ((' 127.0.0.1 ', 8088))

Python Web version Tailf, grep

Python has a plugin that allows us to implement features similar to Linux under Tailf, grep, and awk on a Web page. The name of this plugin is Tailon.Install plug-ins,Pip Install TailonStart the

The most troublesome time for Python is medicine.

Https://www.cnblogs.com/sunshineyang/p/6818834.htmlOne: The time method used frequently1. Get the current time uses the time module to first get the current timestamp in [Time.time]: +/-(): 1408066927.208922 converts the timestamp to a time tuple

Python implementation of the classical sorting algorithm

First, choose the sort Select_sort#Finds the smallest value in an arraydeffindsmallest (arr):#Stores the smallest valuesmallest =Arr[0]#Stores The index of the smallest valueSmallest_index =0 forIinchRange (1, Len (arr)):ifArr[i]

Application of Python+django Framework (I.)

Django Introduction:Django is an open source framework developed in the Python language, released in 2005. Early in the news and Content management site, providing a very powerful post-management system.Django Official website:

Leetcode add-on list-python< two >

Previous: Leetcode Two and-pythonTitle: https://leetcode-cn.com/problems/add-two-numbers/description/A two non-empty list is given to represent two non-negative integers. The digits are stored in reverse order, with each node storing only a single

"Python module" configparser module

Configparser module:is the module used by the Python standard library to parse the configuration file.Format:Section: Using [] to mark section names: or =: using: or = Assignment[Websv]ip: ' 192.168.1.10 ' port:443name = ' root ' pw = ' root1990 '

Python co-process

1. Yleid with generator (), Save status2. User-state switching, switching is determined by the user3. The process itself is a micro-threading4. Co-integration is also for IO operations5. No switching consumption6. The concept of no lock‘‘‘(1)

Python Learning Path day01--if statement

Case of an If statementThe above code, the output is: Audi BMW Subaru ToyotaIi. condition test (conditional expression, format)Each pieceiftrue falsepython The value tested by the condition is truefalseif statement. If the value of the condition

Python-xpath Positioning Method Detailed

First, XPath basic positioning usage1.1 Using ID to locate--driver.find_element_by_xpath ('//input[@id = "kw"])  1.2 Using class positioning-driver.find_element_by_xpath ('//input[@class = "S_ipt"]  1.3 Of course, through the usual 8 ways of

Getting Started with Python re library (regular expression)

Regular Expressions (English name: regular expression,regex,re) are expressions that are used to succinctly Express a set of character strings. The most important applications are in string matching. syntax for regular expressions -common operators:

Python base-Conditional and conditional statements

The following values, when used as Boolean expressions, are considered false:False None 0 "" () [] {}The----is the standard value false and none, all types of numbers 0 (including floating-point, long-integer, and other types), empty sequences

Python Module--hashlib module (Simple File digest algorithm implementation)

#!/usr/bin/env python#-*-coding:utf-8-*-__author__="Loki"#usage:hashlib ModuleImportHashlibImport Time#wrapper function Calc Length and use timedefLen_type_tools (res):defWrapper (*args, * *Kwargs): Cur_time=time.time () len_res= Len (res (*args, * *

Range () \input () \print () \eval () in Python

1. Function range () is a python built-in function that can be used to create a list of integers, typically used in a for loop.function syntaxRange(start, stop[, step]) Parameter description: Start: Count starts from start. The default

How to understand if __name__ = = ' __main__ ' in Python

SummaryPopular understanding __name__ = = '__main__' : If you call Syed Py, in the eyes of friends, you are Syed ( __name__ == ‘李凯‘ ) ; in your own eyes, you are yourself. ( __name__ == ‘__main__‘ ).If __name__ = = '__main__' means: when the.

2018-06-24-python full Stack development day21-part1-file deletion and modification

#上课的时候咩有听太懂, Blur and learn one sideOriginal fileGlobalLog127.0.0.1local2 Daemon Maxconn256Log127.0.0.1local2 infodefaults LogGlobalmode HTTP Timeout connect 5000ms timeout client 50000ms timeout server 50000ms opt Ion Dontlognulllisten

[Python] Basic data types and properties (previous)

1. Basic data types(1) Number-int(2) string-str(3) Boolean value-bool2. Important methods in the INT type(1) INTTo convert a string to a numeric type:# Converts a string of byte numbers to an int type# Converts a string of byte numbers to int type a

"326" Python screenshot and image recognition

Reference: Another way to recognize picture text with PythonReference: Python ai image recognition, Python3 a line of code to achieve picture text recognitionReference: PYTHON3+SELENIUM3 Environment Build Pits TourReference: Python-based-pil

Python crawler "2nd article"

One, multi-process1.fork method (OS module, for LUnix systems)Fork method: Call 1 times and return 2 times. Cause: The operating system replicates a process (child process) through the current process (the parent process), the two processes are

Total Pages: 4013 1 .... 1512 1513 1514 1515 1516 .... 4013 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.