Each language has its own advantages, the combination of each to take the director of the program to execute more efficient or to say which implementation is simpler to use which, Nodejs is to use the child process to invoke system commands or files,
Create: List = [5,7,9]
Values and changes: list[1] = list[1] * 5
End of List insert: List.append (4)
The value that removes the No. 0 value and returns the No. 0 value: List.pop (0)
Remove No. 0 value but not return value: Del (list[0])
Remove a
Recently because of the frequent use of Excel, you need to follow the contents of the Excel table for some apk processing, manual processing is cumbersome, and decided to write a script to deal with. First post a script that reads and writes Excel
How do I add a path "permanent" to Sys.path?
Sys.path is the path set of the Python search module, a list
Copy Code code as follows:
[', ' c:\\windows\\system32\\python26.zip ', ' c:\\python26\\dlls ', ' c:\\python26\ \lib ', ' c:\\
1. Open and close the file (open (), file (), closing ())
There are two built-in functions to get file objects: Open and file. Their usage is exactly the same. The following is just an example of open (). The syntax for getting a file object (open
Many sequences of method strings are equally applicable,However, strings are immutable, so some methods that attempt to change the string are not available
1 string formatting
1 format strings with tuples or dictionaries
format = "hello,%s.s%
Get a Chinese explanation of a word from the Youdao Dictionary Web page.
Import re
import urllib
word=raw_input (' Input a word\n ')
url= ' http://dict.youdao.com/search?q=%s '%word
content=urllib.urlopen (URL)
pattern=re.compile ("",
First look at the effect:
In the Linux terminal, the ANSI escape sequence controls the colorBasic rules: Front plus \033[, end with \033[0m reset to original colorYou can enter the following sentence in the terminal, you can see the output green
First, the algorithm description:
1. First, take a number out of the series as the base number.2. The partitioning process, which places the number larger than this to its right, is less than or equal to its number on the left.3. Repeat the second
Copy Code code as follows:
#-*-Coding:utf-8-*-
From random import RandintFrom math import ceil, floor
def _partition (A, L, R, I):"" "" "in A[i] is the main element dividing the array a[l ... R], so that:A[l.. M-1] """A[i], a[r] = A[r], a[
Learn the use of Python string methods, do a trial of each of the methods listed in the book, record the results, and make it easier to query later.
(1) s.capitalize (); function: Returns a copy of the string and capitalizes the first letter. Use
1, a car website address2, the use of Firefox view found that this site's information does not use JSON data, but simply that HTML page just
3, using the Pyquery in the Pyquery Library for HTML parsing
Page style:
Copy Code code as follows:
Copy Code code as follows:
#设a为字符串
Import time
A = "2011-09-28 10:00:00"
#中间过程, it is generally necessary to convert a string into a time arrayTime.strptime (A, '%y-%m-%d%h:%m:%s ')>>time.struct_time (tm_year=2011, tm_mon=9, tm_mday=27,
Copy Code code as follows:
Import socket
Import re
'''Guangdong Provincial Public Security Bureau entry-Exit government service network passport, pass processing progress inquiries.Analyze URL format for http://www.gdcrj.com/wsyw/tcustomer/
Analysis
A number is often a group of 3 digits followed by a comma, so the rule is: ***,***,***
Regular type
Copy Code code as follows:
[A-z]+,[a-z]?
Copy Code code as follows:
Import re
Sen = "ABC,123,
Copy Code code as follows:
#-*-coding:cp936-*-
From Scapy.all Import *
From threading Import Thread,activecount
From random import Randint
Class Loop (Thread):def __init__ (SELF,REMOTEADDR):Thread.__init__ (self)SELF.REMOTEADDR =
These days with a raw socket, with Python wrote some demo program, here record.
First, let's look at a simple sniffer program:
Copy Code code as follows:
#! /usr/bin/python
# code for Linux
Import socket
#s = Socket.socket
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