First, the object-oriented basis
class: used to describe a collection of objects that have the same properties and methods. It defines the properties and methods that are common to each object in the collection. An object is an instance of
Introduction to Object Orientation
A. Process-oriented: Write code from top to bottom based on business logic.
B. Functional programming: Encapsulate a function code into a function, and you will not need to write it again in the future,
Object-oriented Foundation 1. Briefly
Programming Method:
Process oriented: Execute from top to bottom according to the code in the stacking order of the script
Functional programming: Encapsulate code of the same
Creating Classes and objectsAt first we had a lot of contact programming for process-oriented programming, which was based on business logic from top to bottom code, and then functional programming, is to improve the reusability of code, reduce the
Every parting is to better meet, kissed your forehead again kiss your thick lips.-------HashlinuxNow that we know how to start and exit the Python interactive environment, we can formally start writing Python code.Before you write your code, do not
This section is the last part of the Python built-in module family, and introduces some small and useful built-in modules.Directory:1.random2.shelve3. Getpass4.zipfile5.tarfile6.bisect7.FileinputFirst, randomThe random module is a python-provided
In addition to this semester, we plan to learn Python language and crawler knowledge independently of the curriculum. In terms of books, the O ' Reilly Python and Python network data collection were adopted. The former is used for the study of
The dictionary consists of key and value, and key must be unique, and the value may not be unique. The dictionary is unordered.common methods for dictionaries :Clear ():Clear all contents of the dictionary>>> dic1={"name": "Zeng", "age":--} >>> dic1.
Python Strip () method
DescribeThe Python Strip () method removes the character specified by the string's Kinsoku (the default is a space).GrammarStrip () method syntax:Str. Strip([chars]); Parameters
Chars--Removes the character
Crawler in the development process also has a lot of reuse process, here to summarize, in the future can save some things.1, basic crawl web get methodimport urllib2url = "http://www.baidu.com"response = urllib2.urlopen(url)print response.read()Post
Execution mode:
Enter Python directly into the command line for single-line input execution, exit and not save.
Python filename.py or./filename.py Execute script file directly
Script format:
#! /usr/bin/python Specifies
1. String formattingPercent semicolon formattings = "I am%s"% ' Wyx ' #通过位置传递参数, formatted string types = ' I am% (name) s '% {' name ': ' Wyx '} #通过命名传递参数 s = ' I have percent%.2f '% 1.111 #小数点类型 s = ' I have percent% (p). 2f '% {' P ': 1.1}
First, the Python regular introductionPython's re module, allowing Python to support extended regularExtended regular Character set ("." " [ABC] "(ABC)" "A|b"), Anchor Point ("$" "^" "\"), modifier character ("*" "?") "+" "{}") do not introduce
Python File types:1. Source code file: with "py" as extension, interpreted by Python program(a)# Cat test1.pyprint "Hello world!"# python test1.pyHello world!(b)# Cat test1.py#!/usr/bin/python (this line specifies to be interpreted in Python
Python's unique syntax:
Do not use the semicolon concluding sentence, but enter;
Differentiate code blocks by code indentation;
If, while, for, and so on, do not have parentheses, but no colon (:).
How do I divide a line of
The need for file processing in Python involves OS modules and Shutil modulesGet current working directory path: OS.GETCWD ()Gets all files and directory names under the specified directory name: Os.listdir (dir)Delete files: os.remove (file)Delete
Python capitalize () methodThe capitalize () method returns a copy of the string, with only its first letter capitalized. For a 8-bit string, this method is related to the locale.GrammarThe following is the syntax for the Capitalize ()
Analysis of the use of else statement blocks in Python, analysis of pythonelse statements
All those who have learned C/C ++ know that else statements are used with if statements, but in Python, else statements are more like a module, not only can
Break through the python defects and implement several custom thread pools as well as introduction of processes, threads, and coroutines.Python thread
Threading is used to provide thread-related operations. A thread is the smallest unit of operation
Python calls pytesseract to identify the verification code of a website, pythonpytesseract
1. Introduction to pytesseract
1. pytesseract description
Pytesseract Latest Version 0.1.6, URL: https://pypi.python.org/pypi/pytesseract
Python-tesseract is
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