First, we use Webpy to write a simple website, listen to 8080 ports, and return to the "Hello, everet.org" page.
Then we use our forwarding.py to build two communication pipelines between the 80 port and 8080 ports for two-way communication.
At
In general, we will store our own Python modules separately from Python's own modules for easy maintenance purposes. So how do you add a custom module to Python?
Before we answer this question, we must first clarify two points:
1. Strictly
Perhaps you have used a decorator, it is very simple to use, but difficult to understand (in fact, it is very easy to understand), to understand the adorner, you need to understand the concept of functional programming, Python function definition
*args represents any number of nameless arguments, which is a tuple;**kwargs representing the keyword argument, which is a dict.
def fun (*args, **kwargs): print ' args = ', args print ' Kwargs = ', Kwargs print ' # # # ' If __name__ = = '
What is Epoll
What is Epoll? In the Linux network programming, the long time uses the Select to do the event to trigger. In the new Linux kernel, there is a mechanism to replace it, that is epoll. Of course, this is not the 2.6 kernel, it is
All (iterable)
Version: This function appears for the first time in the python2.5 version, and is suitable for 2.5 or more versions, including Python3, compatible with the Python3 version.
Description: If all elements of iterable are not 0, ',
BOOL ([x])
English Note: Convert a value to a Boolean, using the truth testing procedure. If x is False or omitted, this returns false; Otherwise it returns TRUE. BOOL is also a class, which are a subclass of int. class BOOL cannot be subclassed
Chr (i)
English Description:
Returns the ASCII character corresponding to the integer i. Contrary to the Ord () effect.
Parameter x: A positive number between the range of values [0, 255].
Version: This function is available in each version of
Today to share a very useful and very simple function cmp in Python, as you may guess from the spelling, this is a comparison function, well, yes, it has a return value of only three, positive, 0, negative, here's a look:
CMP (x, y)
英文说明: Compare
Django is an open-source Web application framework written by Python. The MVC Software Design pattern is used, i.e. model M, view V and Controller C. It was originally developed to manage some of the news content-based websites of the Lawrence
Previous article web.py installation in detail and you share the installation of web.py, this section web.py the first page Hello World
If you have a python base, web.py is easy to get started with. Writing Web programs is also very smooth, which is
1. Create a Django Project
#使用下面的命令可以创建一个projectdjango-admin.py startproject mysite #创建好之后可以看到如下的project结构mysite/ manage.py mysite/ __init__.py settings.py urls.py wsgi.py
2. Start the project you just created
Go to the
Filters, changes in the display form of variables
First, form: lowercase
{{name | lower}}
Second, concatenation: First escape the text to HTML, and then convert each line to
Label
{{My_text|escape|linebreaks}}
Three, the parameters of the
One, the template type error:
Cause of error: missing return in models:
Class UserProfile (models. Model):
User=models. Onetoonefield (user,blank=true,null=true,related_name= ' user ', verbose_name=_ (U ' users '))
Company_name=models. Charfield
The 3.x of the Python language is completely non-forward compatible, resulting in a library that we can use normally in python2.x, which is not available to Python3. For example MySQLdb
Currently MYSQLDB does not support python3.x, python3.x
Python is a very expressive language. It provides us with a huge library of standards and many built-in modules to help us get the job done quickly. However, many people may be lost in the functionality it provides, not taking full advantage of the
Python or JavaScript? Although many friends are still arguing about who is stronger and who has a brighter future, there is no doubt that the competition has a clear answer in the Web front-end area. Based on the browser platform, if you abandon
This article mainly describes the Python return true or false (real) small tricks, this article discusses the most concise conditional judgment sentence wording, this article gives two concise wording, the need for friends can refer to the next
There are three list sorting methods in the Python language: Reverse reverse/reverse order, sort positive order, and sorted to get a sorted list. In the more advanced list sort, the latter two methods can also be sorted by adding conditional
Reference count
Python's default garbage collection mechanism is reference counting, and each object maintains a ob_ref field. Its advantage is that the mechanism is simple, when the new reference point to the object, the reference count plus 1,
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