1. Install geoip c library first
geoip c library >= 1.4.6 installed on your machine. >= 1.4.6 installed on your machine.
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.7.tar.gztar -xvzf GeoIP-1.4.7.tar.gzcd GeoIP-1.4.7./confiuremake
Static methods are independent of instances of classes and classes. They are methods defined in the scope of classes. It can be called directly by classes and instances.
Both class methods and static methods must be defined by the decorator. The
1. String Conversion
S. lower () to lowercase
S. upper () is converted to uppercase
S. swapcase () in upper case and lower case in upper case
S. capitalize () is capitalized.
Convert to int type string. atoi (s) or int (s)
Convert to float type
Although today's blogs are not as popular as those of the past few years, RSS is still very creative and practical. RSS is a simple XML format used to distribute summaries of content on websites. It can be used to share a variety of information.
Chapter 8 standard library II
The second part covers many advanced modules that can better meet the needs of professional developers. These modules rarely appear in small scripts.8.1 output formatting
The Reprlib module provides a customized version
Basic customization typeC. _ init _ (self [, arg1,...]) constructor (with some optional parameters)C. _ new _ (self [, arg1,...]) constructor (with some optional parameters); it is usually used to set a subclass of the unchanged data type.C. _ del _
7.1 Operating System Interface
The OS module provides a number of major functions that interact with the operating system.
>>> Import OS
>>> OS. getcwd () # Return the current working directory
'C: \ python31'
>>> OS. chdir ('/server/accesslogs') #
This article describes how to organize statements into functions, the concept of parameters, and their usage in programs.
URL: http://www.cnblogs.com/archimedes/p/python-abstract.html.
Create a function
The built-in callable function can be used to
6.10 Generator
A generator is a simple and powerful tool for creating an iterator. They are written as standard functions, but can return data at any time using yield statements. Every time the next () method is called on it, the generator continues
I took a look at the python getting started book and used a small game to train my hands. In fact, there are just a few lines of code, and only the novice and the cheek-to-face loggings make me look ugly.
Just like Zhang xzhong, come to Shanghai,
6.9 iterator
So far, you may have noticed that many container objects can use the for statement for loop:
This access style is clear, concise, and convenient. The application of the iterator is python traversal. In this scenario, the for
6.7 remarks
Sometimes there is a data type like "record" in Pasca and "data body" in C that is very useful. Set some data items. An empty class definition can be clearly displayed:
Class Employee:
Pass
John = Employee () # Create an empty
6.5.1 multi-Inheritance
Python also supports multiple inheritance forms. A class that can inherit multiple base classes is defined as follows:
Class DerivedClassName (Base1, Base2, Base3 ):
.
.
.
In most cases, you can consider the property
Today, my colleague wants to test the WAF page statistics function, so he needs to simulate multiple IP addresses to send requests to multiple domain names, that is, to modify the source IP address. This is troublesome if you use the socket library,
Python generates thumbnails of a specified size
Copy codeThe Code is as follows:Def MakeThumb (path, sizes = (75, 32, 16 )):"""Thumbnail Generation Program by Neil ChenThe sizes parameter is used to generate multiple dimensions."""Base, ext = OS.
If you want to write a program, set x1 to 1 and x2 to 2 until x100 is 100, what would you do?
In a static language such as C, the variable name identifier is actually translated into a memory address by the compiler. Therefore, you cannot set the
6.4 instructions
You can override method attributes with the same name for data attributes. This is to avoid unexpected name conflicts in large systems. Therefore, it is very effective to use some common methods to reduce conflicts. Common methods
Quick sorting
Fast sorting also uses a divide-and-conquer policy to improve performance without additional memory. However, the cost of doing so is that the list is not segmented in half, so the performance will decrease.
Select a value for quick
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.