1, use Python library urllib2, use the Urlopen and request method.
2, Method Urlopen prototype
Urllib2.urlopen (url[, data][, timeout])
which
The URL represents the destination page address, can be a string, or it can be a request object
Data
When using the requests library, there will be the situation of Chinese garbled
Reference Code Analysis Python requests Library Chinese coding problem
Python HTTP Library Requests Chinese page garbled solution.
Analysis
According to the two articles,
Recently ready to use Django to write a CMS system, the Unit's web page migration past, the Internet to find a blog system, but not very satisfied, summary and tags are required to enter their own, the goal is to automate their
Blog Domain name: Http://www.xnerv.wang
Original title page: https://oj.leetcode.com/problems/search-insert-position/
Topic type: Two-point search
Difficulty Evaluation: ★
This article address: http://blog.csdn.net/nerv3x3/article/details/39453389
The cause and significance of the project
At first it was interesting to see an article when I was browsing (using Python to analyze the dream of Red mansions), this article is longer, the main theme adopted a series of methods to analyze the first
For b in range (1,5): for s in range (1,5): for G in range (1,5): if B!=s and B!=g and s!=g: Print B,s,g//======================================================= #-*-coding:utf-8-*-sums=0.0 money=0 .0 Money=raw_input ("Enter bonus:") # print "hello.%
Blog Domain name: Http://www.xnerv.wang
Original title page: https://oj.leetcode.com/problems/merge-two-sorted-lists/
Topic Type:
Difficulty Evaluation: ★
This article address: http://blog.csdn.net/nerv3x3/article/details/3465680
Merge two
Error:pyinstaller for Python 2.6+ on Windows needs pywin32.
Problem Description
Today, when you were creating a Python packaged environment for a Windows platform, you encountered the following error in packaging with Pyinstaller:
#!/usr/bin/env python #-*-coding:utf-8-*-' @property ' __author__ = ' Hui.qian ' class Student (object): pass s = St Udent () s.age = 1000 print s.age ' in the actual process, the age is certainly not greater than 1000 years old This illustrates a
1, two ways to execute a python script
First, configure the environment variable, find the Pyhon file, in the form of: Python 1.py
Second, enter the interpreter, the real time input output, the form: Python
In Linux, adding the statement inside the
Input and raw_input can be used to read console inputs, and input () can only accept int,float or an expression composed of them:
Python 2.7.5 (default, Mar 2014, 07:24:16)
[GCC 4.5.4] on linux2
Type ' help ', ' copyright ', ' credits ' or ' Licens
Python-xlib
About Xlib, online related are less, can only get information from the library file Http://python-xlib.sourceforge.net/?page=home
The basic concept is that the program and X server establish a connection, then communicate, event and so
http://blog.csdn.net/hushiwen/article/details/8531302
Specifically, the use of SetAttr, __setattr__, __dict__, and so on, you can see the Python manual, just write a small piece of code for example.
Class Foo:Passdef test (self):print "Hello"
First, download and install Python.
Then download the Pymongo.
Open the Python Shell, create a new py file, and typing code inside:
Import Pymongo
//How the database is on the server, the localhost is changed to the IP address, and the port
Python is an object-oriented interpretive computer programming language that focuses on the readability of code and is also a powerful universal language. Beginner's introduction Junior Player Senior Experts Senior Talent First, novice beginners
simulated landing watercress
The first login required authentication code, after the landing can be hidden "login (" username ', ' password '), because the use of session to save the necessary login information, the code is as follows:
Import
Word cloud is a way to display, although in absolute terms there is no way to give too much information, but can give people a stronger visual feeling.
This thing is mainly fun.
The individual modified a little on the basis of the original author to
According to the official document (http://www.python-requests.org/en/master/),requests allows the HTTP request to be sent automatically without having to manually post the URL Add a query string to the address or manually encode the data to be
1Name ="My name is Irving and I am years old!"2 3 #开头字母大写4 print (Name.capitalize ())5 6 #统计某字符个数7Print (Name.count ("I"))8 9#把字符串延长至50字节, and centered, insufficient "--"CompleteTenPrint (Name.center ( -,"-")) One A#检查是否以 "LD"End -Print
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