Python crawls site pictures and places them in the specified folder
Copy the Code code as follows:
#-*-Coding=utf-8-*-
Import Urllib2
Import Urllib
Import socket
Import OS
Import re
Def docment ():
Print u ' file exists E:\Python\ (please enter a
A function with yield is a generator, which, unlike a normal function, generates a generator that looks like a function call, but does not execute any function code until it calls next () (which is automatically called next () in the For loop) to
1. chr (i)
The CHR () function returns a string corresponding to the ASCII code.
Copy CodeThe code is as follows:
>>> Print Chr (65)
A
>>> Print Chr (66)
>>> print Chr (+CHR) (66)
Ab
2, complex (Real[,imaginary])The complex () function converts
Use the interface provided by Http://tool.oschina.net/less to send requests for remote compilation.
The compiled less is then saved in a file with the same name as the suffix CSS.
The first time you use Python, the code is pieced together. You need
Lists are the most basic data structures in Python, and the list is the most commonly used Python data type, and the list's data items do not need to have the same type. Each element in the list is assigned a number-its position, or index, the first
First, the use of methods and performance, see the Picture:
Second, Python implementation code:
Copy the Code code as follows:
[Root@yang python]# VI check_ip.py#!/usr/bin/pythonImport Os,sysdef check_ip (ipaddr):Import SysAddr=ipaddr.strip ().
Learn Python Example: Implement save Web page to local
Copy the Code code as follows:
#coding =utf-8__auther__ = ' Xianbao 'Import UrllibImport OSdef reporthook (Blocks_read, Block_size, total_size):If not blocks_read:print ' Open connection
Brief introduction
Tuple
1. Tuples are collections of data surrounded by parentheses "()", separated by "," by different members. Access by subscript
2. Immutable sequences, which can be seen as immutable lists, are different from the list: once
1. Sort in place: Use the sort () method to arrange the data in the order specified and replace the original data with the sorted data (the original order is lost), such as:
Copy the Code code as follows:
>>> data1=[4,2,6,432,78,43,22,896,42,677,1
To achieve a simple multi-threaded download, you need to pay attention to the following points:
1. File size: Can be extracted from the reponse header, such as "content-length:911" indicates the size is 911 bytes
2. Task splitting: Specify which
There is a common command on Linux curl (very useful), support curl is the famous Libcurl library, Libcurl is a powerful, and very efficient function library. In addition to providing its own C API, Libcurl has a binding of up to 40 programming
Python uses the cTYPES module to invoke the Windows API GetVersionEx get the current system version without using Python32
Copy the Code code as follows:
#!c:/python27/python.exe
#-*-Coding:utf-8-*-
"Judging the current system version by invoking
Using Baidu Dictionary to carry out Chinese-English translation
Copy the Code code as follows:
Import Urllib2
Import re
Import Sys
Reload (SYS)Sys.setdefaultencoding (' Utf-8 ')DEF Tran (word):Url= ' http://dict.baidu.com/s?wd={0}&tn=dict '.
Recently in a project to use the HTML5 introduced in the WebSocket technology, I thought it should be easy to handle, who knows in the real development after the discovery of a lot of trouble, although we are a front-end development and design of
If the Windows installation is complete, you need to add ' \python27\scripts\ ' to the system environment variable
Copy the Code code as follows:
# Coding=utf-8Import OSImport Urllib2Url= ' https://raw.github.com/pypa/pip/master/contrib/get-pip.
Ideas
You need to implement a source code that is not infected and one that may be infected, and then run the following script to find out exactly which files are being hung.
Among them, the main is based on the MD5 value of 2 files to filter the
Because to batch with a software batch of EPS files, so to simulate the mouse and keyboard action, so that it can automate the operation.
Copy the Code code as follows:
#-*-coding:utf-8-*-
Import OS
Import time
Import Win32gui
Import
The previous period of time for the preparation of Baidu interview bad things, although the final still be brushed, or the days of the "booty" put points up, the algorithm has been a relatively weak place, after the more efforts ah.
The following
STEP1: Installing Python and Sublime
STEP2: Install the package control for sublime, installation see: Official website
STEP3: Configuring the installation path
Mode one: Configure path for Windows
The advantage is that the CMD can also be run,
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