Here and get the link slightly different, not get linked to the URL, but instead get the text content of each link#!/opt/yrd_soft/bin/pythonimport reimport urllib2import requestsimport lxmlfrom bs4 Import BeautifulSoupurl = ' HTTP// Www.baidu.com '
Program Directory Specification:Bin # Store Executable program xxxx.py # Program Main program (entry file)Config # store configuration information settings.py # Global configuration file(may not be applied temporarily)DB # Storing data files
Two modules for serializationJSON: Used to convert between string and Python data typesPickle: Converting between Python-specific types and Python data typesJSON offers four features: Dumps,dump,loads,loadPickle offers four functions:
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
The official documentation has a phrase "allows you to call any program" and:Helps you write shell scripts In python by giving you the good features of bash first sentence to help you easily call your own program in Python, the second sentence gives
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
PYTHON specifies special variables with underscores as variable prefixes and suffixes_xxx cannot be imported with ' from module import * '__xxx__ System Definition NamePrivate variable names in the __xxx classCore style: Avoid using underscores as
#以下介绍是基于Python3.4.3I. INTRODUCTIONThe Urllib.request.urlopen () function is used to implement access to the destination URL.The function prototype is as follows:urllib.request. Urlopen (url, data=none, [timeout, ]*, cafile=none, capath=none,
Python uninstall module method summary, python uninstall Summary
Easy_install uninstall
The modules installed through easy_install can be uninstalled directly through easy_install-m PackageName, and then the egg under the \ Python27 \ Lib \
Multiple python threads and concurrent execution of multiple commands
I. Introduction to concepts
Thread is one of the most important classes in the threading module and can be used to create threads. There are two ways to create a Thread: one is to
The Python Flask framework application implements the login method using the QQ account, pythonflask
Flask-OAuthlib is the Flask extension Implementation of OAuthlib,Project address:Https://github.com/lepture/flask-oauthlibMain features:
Supports
Simple implementation of PYTHON flattened nesting list, python flattened nesting
List is the most frequently used data type in Python. A wide range of functions are available in the standard library.
However, if you convert a multi-dimensional list
Function summary in python: decorator closure details, python details
1. Preface
A function is also an object that can add attributes and use periods to represent attributes.
If the definition of an internal function contains a reference to an
Analysis of getattr (), setattr (), delattr (), hasattr (), and getattrsetattr in Python
Getattr () functionIs the core function of Python introspection. The usage is as follows:
Get object reference getattr
Getattr is used to return an object
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
Underline in python skills (2) and underline in python skills
Python uses underscores (_) as the prefix and suffix of variables to specify special variables.
_ Xxx cannot be imported using 'from module import *'
_ Xxx _ system definition name
_
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