Nicecui
This article declined to reprint, if necessary to obtain the author's consent, thank you.
This article link: http://www.cnblogs.com/NiceCui/p/7858473.html
Email: [Email protected]
Date: 2017-11-18
Python learning
1) InheritanceBase class Baseclass:def __init__ (self,name,age): self.name = name Self.age = Age print "BaseClass I S inited "Def speak (Self,name): print" base class is speak:%s "%name if __name__ = =" __main__ ": b = BaseClass () derived class
CSV file write Chinese garbled problem and read-write error
In python2.7, the following error occurred after running the program.1 Traceback (most recent):213File"c:/users/administrator/desktop/python_code/untitled0.py", line 57,inch4File=open (
Import Timetime.sleep (5) #以秒为单位暂停print (Time.clock ()) # returns processor Time, 3.3 obsolete, changed to Time.process_time () measuring processor time, excluding sleep time , unstable, can't be measured on Mac print (Time.altzone) # Returns the
Read Catalogue
A data type
Two anonymous functions
Three adorners, generators, iterators
Four sort, sorted
Five-list derivation, generator expression,
Six and-or
Seven map functions
Eight multi-threaded multi-process Gil
Nine OS,
This article mainly describes how to find the absolute path of a Python module, the following is an example of OPENCV module lookup. There are two waysThe first of these methodsOpen a terminal, enterPython-vImport Cv2The last line shows the
ImportNumPy as Nplist= [[1,3,5,7],[2,4,6,8]]np_list= Np.array (list)#convert l list data to an array typePrint(np_list)" "[ [1 3 5 7] [2 4 6 8]" "Np_list1= Np.array (list,dtype=np.float)#The type of the array is defined by Dtype, and the default
1. Lists and dictionaries, directly assigned, are shallow copies, where both sides point to the same address, because Python passes by reference to mutable objects.>>> a = [1, 2, 3]>>> B =a>>>b[1, 2, 3]>>> A[0] ='Apple'>>>a['Apple', 2, 3]>>>b['Apple'
Given a 2d grid map ‘1‘ of S (land) ‘0‘ and S (water), count the number of islands. An island is surrounded by water and are formed by connecting adjacent lands horizontally or vertically. Assume all four edges of the grid is all surrounded by water.
Objective to introduce:Using the Python script to analyze Nginx's access_log log, get the number of accesses per IP, build a dictionary of IP and access times, and finally sort the dictionary input.#!/usr/bin/env python#-*-coding:utf8-*-"" "Analysis
Idea: 1. Use a stack to save the node (list implementation); 2. If the node exists, enter the stack, and then point the current pointer to the left dial hand tree until it is empty; 3. If the current node does not exist, the top element of the stack
Python3 selenium, python3selenium
In fact, this is equivalent to simulating a person's Click Event to continuously access the browser. If you have played the glory of the king, there will be a bug in the January 2016 version.
After downloading a key
Verify logon,Registration, verification login, three wrong passwords in the dark house
_ Author _ = 'weihui' def register (): f = open ("login_info", "r +", encoding = 'utf-8') try: name = input ("name:") for line in f. readlines (): if name in
Teach you how to create a sub-domain name collection and information collection sub-domain name
This task: use scripts to collect website subdomain name information using search engines.Preparation tools: python installation package, pip, http
Python: simple construction of blocking single process, multi-process, multi-threaded service instances, python Multithreading
We can understand the working principle of apache in this way.
1 single-process TCP Service (congested)
This is the most
How to install Numpy and matplotlib in Python (recommended), numpymatplotlib
How to install Numpy and matplotlib in Python (recommended)
Note:
Cp27 indicates python2.7 In the downloaded database name.
Input import pip; print (pip. pepw.tags.
Before the python Chinese Word Segmentation tutorial, explain to the largest forward matching algorithm,
Preface
As we all know, Word Segmentation in English is easier because words are separated by spaces, and Chinese characters are different, A
Use the latest pitfall practice record of Pyinstaller, pyinstaller
Preface
The Pyinstaller can be translated into an executable file using pyinstaller. This document describes how to use pyinstallerto convert pythonprogram .pyto .exe. Before
Introduction to the trigonometric function atan2 () function in Python, pythonatan2
Description
Atan2 () returns the arc tangent of the given X and Y coordinate values.
Syntax
The syntax of the atan2 () method is as follows:
import mathmath.atan2(y,
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