2017-07-26 10:10:11Beautiful soup can parse files in HTML and XML format.The Beautiful Soup Library is a library of functions that parse, traverse, and maintain the tag tree . Using the BeautifulSoup library is very simple, just two lines of code,
Learn python start the first program Hello,world
Python installation This blogger is already a veteran, Windows environment is running.
This is already installed in the Python environment, win+r input cmd in the cmd window input python
2017-07-25 21:08:16First, the scale of the web crawlerRestriction of web crawler? SOURCE review: Judge User‐agent to limitCheck the user‐agent domain of the incoming HTTP protocol header, only in response to browser or friendly crawler access? Post
One, namespace#局部命名空间#全局命名空间#内置命名空间#三者的顺序#加载顺序 the hard drive--in memory#内置--Global (loaded from top to bottom)--local (loaded when called)1 #!/usr/bin/env python2 #_*_coding:utf-8_*_3 4 #Global Namespaces5A = 56b = 87 #local namespaces (functions)8
Python Asset Management One, Agent mode1. Advantages of this method: the use of simple, fast, suitable for the server more scenes use, the disadvantage: the server compared to the resources, performance will become lower.2. Using the agent is a
Python is used to get the path of the module by using: Sys.path, but a list is returnedAdd your own module to the Python module path: sys.path.append (Os.path.abspath ('%s.. /.. /'% sys.path[0])) using the ' append ' keyword;and see how the Great
This slag in addition to work, in life or some hobbies, some things, once infected, can not extricate themselves, can not go ashore, from a road of no return. The insects of flowers and birds is my hobby which has persisted for decades.This slag
Chapter Content
Higher order functions
Decorative Device
ObjectiveThen the previous function is organized.first, higher order functionThe higher order function is to pass a function as an argument to another function1 defMain_func (
Job Requirements:Implementing User name Password login verification
Determine whether the user name password is correct, print the welcome message correctly, error output specific error cause information
Users can enter the password
The SYS module operates as follows:1sys.argv#implements passing parameters from outside the program to the program. 2Sys.exit ([ARG])#exit in the middle of the program, arg=0 for normal exit. 3Sys.getdefaultencoding ()#gets the system current
Advanced knowledge points include:
Static file Processing
Middleware
Upload image
Admin site
Page out
Using jquery to complete Ajax
Managing Static Files
CSS, pictures, js are static files in the project
Calling third-party mailboxes using Python bulk mail third-party mail needs to set the authorization code here is 163 mailbox, the map cannot be uploaded. Set ===> mailbox security Settings ===> client authorization Password Code section: #!/usr/bin/
function definition:
def def_name (): "" "xxxxxxxx" "" #文档描述 (note) xxxxxxxxxx #语句块 return x #返回值
Procedure and function differences: a procedure is a function return value problem with no return value: Returns none if there is no return
About the functions of the fileW Write modeA append mode opens (starting with EOF, creating a new file if necessary)R+ Open in read-write modew+ Open in read-write modeA + opens in read-write modeRB opens in binary read modeWB opens in binary write
Definition: The package essence is a directory (must have a __init__.py file), it is used to logically organize modules to import the essence of the package: Execute the package under the __init__.py file to import the module in the current
#, write the function, calculate the number of "number", "Letter", "space" and "other" in the incoming stringdef count (s):Nu,st,sp,it = 0,0,0,0For I in S:If I.isdigit ():Nu + = 1Elif I.isalpha ():St + + 1Elif I.isspace ():SP + = 1Else:it + = 1Print
Directory specification:Preliminary knowledge:
to implement a module call between different directories you must create an empty __init__.py file in the current folder (Pycharm will be created automatically when creating the Python package),
Function Overview Table (i) naming rules for function names: 1, The function name must consist of the letter underscore number, cannot be the keyword and the number beginning2, function name or to have a certain meaning can simply explain the
Add, delete, modify, query, and operate on Mysql and djangomysql Databases
The following describes how to add, delete, modify, and query django:
1. view. py
#-*-Coding: UTF-8 -*-From _ future _ import unicode_literalsFrom django. http import
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