Original address http://python.net /~ Goodger/projects/pycon/2007/idiomatic/handout.html. I have chosen some important translations. In short,CodeIt is written to people, not to machines.
White (1)
(1: four spaces are added for each
1) currently, the device has reserved a test interface, that is, sending and receiving messages. Previously, Ruby + swig was used for a strength test tool, and now python is used. Dpkt is used for encapsulation of data structures.
2) aboveCodeThen,
I am not familiar with python for the first time. Some of them are easy to remember.
1. Install Python and Pil
My centos6 does not know when python is installed.
[Root @ foxni/home/lelefox/simple verification code/image/font] # PythonPython 2.6
My personal understanding is as follows. If you have any mistakes, please correct them. Thank you very much!
First, let's look at getattr, as its name implies, to get the property. It should all be getattr (object, "attribution", none). In
Using the pickle module, you can directly save Python objects to files without converting them into strings or writing them into a binary file without using the underlying file access operations. The pickle module will create a binary format
I have read a piece of Python code. The function in the Meta class returns a class. I am puzzled. Why? After debugging, I finally understood why.
>>> Class test (type ):... Pass...>>> Class test1 (TEST ):... Def fun (CLS, count ):... Print count...>>
The core of the singleton mode is to construct a private function. A new private instance is created inside the class, and a method can be provided to obtain the instance from outside the class.
''''''Class Singleton (object ):_ Instance = noneDef _
A netizen asked a question on the Internet:
>>> Class test (type ):
... Pass...>>> Class test1 (TEST ):... Def _ call _ (Self ):... Print "I am in call"...>>> Class Test2 (object ):... _ Metaclass __= test1...>>> T = Test2 ()I am in call
Here _
Isinstance(
Object, classinfo)
Return true if
ObjectArgument is an instance of
ClassinfoArgument, or of a (direct or indirect) subclass thereof. Also return true if
ClassinfoIs a type object and
ObjectIs an
Reading files in python is always a text file. The method is as follows:Lines=open('ft.txt ')
But when I read a large file of several hundred megabytes two days ago, I encountered a strange problem. I thought it was because the content was not fully
Sender: n23 (23rd), email area: Python
Title: ZZ what's new in Python 2.6 (7)-pep 3101: improved words
Mail station: shuimu community (Tue Oct 7 17:20:45 2008), mail
Pep 3101: improved string formatting
In Python 3.0, the % operator is enhanced by
A function containing yield is a generator, not a common function. The generator contains an iterator. "Hugo" does not understand what generators and iterators are. See
Http://blog.csdn.net/xiaofeng_yan/archive/2010/09/27/5910215.aspx
The following
Document directory
GBK decode
East_asian_width
Urwid Solution
Reprinted: http://likang.me/blog/2012/04/13/calculate-character-width-in-python/
Recently, I used python to write a CLI applet, which involves calculating the character width.
Http://cache.baidu.com/C? M = queue & P = 882a9643d58512a05beace375744cf20 & newp = queue & User = Baidu & fm = SC & query = Python + partition & qid = ff4e5bcf244c9d94 & p1 = 2
Added a new Partition Function in version 2.5. What can it do? Here
After adding print and executing the script, the inefficient debug method should be completed. If you are familiar with GDB, you should easily accept PDB. Official Document address: http://docs.python.org/library/pdb.html.
There are two ways to use
Reprinted: http://leequery.blog.163.com/blog/static/16842209620117184345180/
Two interesting attributes of Python_ All _ can be used to set the module import time limit, for example:From module import *If the _ all _ attribute is defined in the
The slicing function in python is powerful. However, slice is easy to confuse.
I personally think that python documents are not very good, and many things are scattered, more like textbooks.
The following references are from the python3.2 document
>>> Import thisThe Zen of Python, by Tim Peters
Beautiful is better than uugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested.Sparse is better than dense.Readability
I predict that in time it will be seen as one of the more powerful features in the language. the problem is that all the introductions to decorators that I have seen have been rather confusing, so I will try to rectify that here.
(This series of
Introduction
def()Is the function which can be used to expose C ++ functions and callable objects as Python functions in the currentscope.
This function can be used to export functions in C ++ to Python. To be honest, it's really easy to
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