This is the project one is the database big job, on the other hand is also familiar with Falsk and Python, for a long time do not forget quickly.Interface compared to the previous project looks a lot, but because the time is tight plus only I write,
Key Summary record1. The life cycle of the Django requestRouting System--try the function (get template + data = "render), and return the string to the user2. Routing System/index/, function or class. As_view ()/detail/(\d+), function (parameter) or
Higher-order functions can receive functions for parameters, and sometimes we do not need to explicitly define functions, and it is more convenient to pass in anonymous functions directly.In Python, there is a limited amount of support for anonymous
Loops are used to repeatedly execute some programs.For loop The For loop requires a pre-set number of cycles N, and then executes the statement that belongs to the for.The basic structure is for inch sequence: statementSuch as: for inch
Then a log, http://zidingyi.blog.51cto.com/10735263/1873566First, let's see what Parse_args () is returning. He returned two values. One is options, one is args!#!/usr/bin/env python#coding:utf-8# statistical import sys, osfrom optparse import of
Python file operations
It's a lot easier to do than files in Java,python.Python Gets the folder where the current file resides:Os.path.dirname (__file__)Wrote a tool class to generate files under the current folder, so it's easy toclass Util ():
Operation of the browser1) Maximum Browsercode example:#coding =utf-8From selenium import WebdriverDriver = Webdriver. Firefox ()Driver.get ("http://www.baidu.com")Print "Browser maximized"Driver.maximize_window () #将浏览器最大化显示Driver.quit ()2) Set the
String manipulation:#!/usr/bin/env python# -*- coding: utf-8 -*-# author:jack niuname = "My \tname is {name}" #加入一个tab键的空格print (Name.capitalize ()) Capital Letter print (Name.count ("a")) # How many aprint in the string (Name.center (50, "-"))
One, sys moduleContains the relevant functions of the system. Let's learn sys.argv, which contains command-line arguments.Example: An add function is defined that implements the addition of two integers.#! coding=utf-8# usersys.pyimport sysdef Add (
1. Print the progress barImport Sys,time for in range: sys.stdout.write ("#" )# print output without waiting for the buffer to be full Time.sleep (0.1)2. "R+", "w+", "A +", "RB" reading and writing mode, read-write mode, append read/write
In many programming languages, there is the ability to format strings, such as formatted input and output in C and Fortran languages. Python has a built-in operation to format the string.
Template
When formatting a string, Python uses a string as
Background:In the execution of some Python scripts, the process of executing the script often occurs, do not know how much the script executes, this problem has always been very vexed to ME. So deliberately summed up, the progress of the preparation
We recommend that you install two text editors after installing python,Notepad ++ 7.2.2 and Sublime Text
-- DaoxinNotepad ++ 7.2.2
Notepad ++ is a distinctive editor that is open-source software and can be used for free. Supported languages: C, C ++,
Python-function, python Function Definition
Functions are organized and reusable, and used to implement a single, or associated function code segment.
Functions can improve the app's vigilance and reuse of code. You already know that Python provides
Python data type, python
1. Note the difference between list and set. set
List representation: list_1 = [1, 3, 4]; set representation: set_1 = set ()
List_1 = [1, 2, 3, 4, 23,4, 2] print (list_1, type (list_1) list_1 = set (list_1) print (list_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