Transferred from: http://blog.csdn.net/handsomekang/article/details/9183303 Since python2.6, a new function Str.format () that formats the string has been added to the power. So, what's the advantage of being compared to the previous% format string?
sorted (...)Help on built-in function sorted in module __builtin__:Sorted (...)Sorted (iterable, Cmp=none, Key=none, Reverse=false)--New sorted listSort (...)Help on built-in function sort:Sort (...)L.sort (Cmp=none, Key=none, Reverse=false)-stable
1, File open and create#file () Used for file management (name, mode [, Buffering]]) name is filename, present-open; not present-create mode for open mode, R, R+, W, w+, A, A +, B, u, etc.2, read the file#open () reads the file Data=open ('
always worry about is the debugging of Python, before writing C are compiled with GDB directly debugging, relaxed and happy. Now it's an interpretive program that doesn't know what to do. With log bar, sometimes is a small program, do not want to
There are two modules thread and threading that handle multithreading in Python. Thread provides a multi-threaded support of the module, with the low-level original hair that is to handle and control the thread, the use of more complex, and
Features of Dict1: Fast Search speed2: Wasted Space3:key can not be repeated, and not variable4: Data disordered emissionsThe first feature of Dict is that the search speed is fast, regardless of whether the dict has 10 elements or 100,000 elements,
Python operatorsPython logical operatorsand Boolean with-if X is False,x and Y returns false, otherwise it returns the computed value of Y.
or Boolean or-if x is true, it returns true, otherwise it returns the computed value of Y.
Not
How to use the lambda and filter functionsHow to use map to avoid loopsString substitutionGetopt Module4.1 Lambda and filter: simple anonymous functions4.2Map Short Circuit cycle4.3 Making decisions in a list--list parsing4.4 Generating iterators
virtualenv enables multiple python to be independent from each other, and it can:1. Install the new kit without permission2. Different applications can use different versions of the kit3. Package upgrade does not affect other
First, the use of web crawler to download Han Cold blog post, the main need to use the following knowledge points:1, a brief understanding of HTML markup Language, familiar with the HTTP protocol, the discovery of HTML laws2, familiar with Urllib
Python Pre-loads a batch of built-in modules into memory when it initializes the runtime environment.All pre-loaded modules are as follows:1>>> forIteminchSys.modules.items ():2...PrintItem3 ...4('Copy_reg', 'Copy_reg' from
Append () and insert ()Add new ElementNow, there are 3 students in the class:>>> L = [' Adam ', ' Lisa ', ' Bart ']Today, the class transferred to a new classmate Paul, how to add new students to the existing list?The first option is to append the
1.strip Remove the kinsoku characters>>> A ='ABCD'. Strip ('a')#Delete the header of a>>>Print(a) BCD>>> A ='ABCD'. Strip ('D')#Delete the trailing d>>>Print(a) ABC>>> A ='ABCDA'. Strip ('a')#Remove the end-to-end a>>>Print(a) BCD2.lstrip Delete
in fact, in Python, time is simply the following two forms of existence:Time, there are generally two kinds of temporal forms:1. Timestamp: Offset calculated in seconds relative to 1970.1.1 00:00:002. Tuple form: Struct_timeThe methods of the time
Unicode stringThe string also has an encoding problem.Because a computer can only handle numbers, if you are working with text, you must convert the text to a number before processing it. The oldest computer was designed with 8 bits (bit) as a byte (
Check the Python 3.3 code for the progress query for the Hong Kong and Macau Pass. Use the socket to request the relevant website, get the results and use the regular to find out the progress of processing. In fact, with URLLIB code will be more
Python Debug single-step debugging, pythondebugI have been worried about python debugging. I used to compile c and debug it directly with gdb, Which is easy and pleasant. I don't know what to do if I encounter such an interpreted program. Using log
Python study note 18: multiprocessing package)We can use the subprocess package to create sub-processes, but this package has two major limitations:1) We always allow subprocess to run external programs, rather than running a function written inside
Python creates and appends object content instances,
1. Create a new file in Python with an integer ranging from 0 to 9. Each number occupies one row:
Copy codeThe Code is as follows:# Python>>> F=open('f.txt ', 'w') # r read-only, w writable, a
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