Web development based on hi-nginx (python) -- start, hi-nginxpython
Hi-nginx not only makes python web applications run fast, but also makes related development simple and agile.
For the installation of hi-nginx, see:
In the Mako template, Def and block are all functions that can be called. Def is more similar to Python def and block is more Layout-oriented.
Def Basics
Def requires a name attribute, such
Hello World
Call the following method:
Web development based on hi-nginx (python)-Dynamic Routing and request method, hi-nginxpython
The route decorator provided by hi. py accepts two parameters: the first parameter specifies the regular mode of the dynamic route, and the second
function (Def)function is to give a program a name, use the name to execute a program, repeated use.Keyword ' def ' to define, identifier (parameter)Examples of function use:1.Def boy ():Print ("Hi,world")The above function is relatively simple, run
Now, with the basic understanding of getting started, we now need a simple and easy-to-use routing function comparable to flask or bottle, which can be used to map URLs to code with an adorner.This, it's not hard. First, a module called Hi: hi.py:1
The provided route adorner for hi.py accepts two parameters, the first parameter specifies the regular mode of dynamic routing, and the second parameter specifies a list of agreed HTTP request methods.Like what: 1 @app. Route (R " ^/client/?$ ", [
Selected 10 of the highest frequency of the topic, with the answer for your small partners reference!What do 1.*args and **kwargs mean?A: *args represents a mutable parameter (variadic arguments), which allows you to pass in 0 or any of the nameless
1. Map, filter, reduce
1) Map (func, Input_list)
Apply the function to each element on the input list, such as:
Input_list = [1, 2, 3, 4, 5]
def pow_elem (x):"""To do a exponentiation on X:p Aram x:: return:"""return x * x
def multi_x_y (x,
1. Map, filter, reduce1) Map (func, Input_list)Apply the function to each element on the input list, such as:Input_list = [1, 2, 3, 4, 5]def pow_elem (x):"""To do a exponentiation on X:p Aram x:: return:"""return x * xdef multi_x_y (x, y):return x *
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.