Python Django Connection DatabaseFirst, install the database# yum-y install MySQL mysql-devel mysql-serverSecond, see if the Python database component is installed# Rpm-qa | grep Mysql-pythonMysql-python-1.2.3-0.3.c1.1.el6.x86_64Third, create the
Vamei Source: Http://www.cnblogs.com/vamei Welcome reprint, Please also keep this statement. Thank you!Python operators are similar to other languages(We only know the basic usage of these operators for the time being, so we could expand the content
Vamei Source: Http://www.cnblogs.com/vamei Welcome reprint, Please also keep this statement. Thank you!Simple data types and assignmentsVariables do not need to be declaredPython variables do not need to be declared, you can enter directly:>>>a =
1.Python File Type:
Source code: The extension ends with a py. Python-written programs do not need to be compiled into binary code and can be run directly. Pyw is the source file for developing graphical interfaces under Windows.
BYTE
Python (United Kingdom pronunciation:/?pa?θ?n/American pronunciation:/?pa?θɑ?n/), is an object-oriented, interpreted computer programming language, invented by Guido van Rossum in 1989, the first public release was released in 1991. Python is purely
Object-oriented Advanced Syntax section
Static methods, class methods, property methods
Special methods for classes
Reflection
Exception handling
Socket Development Basics
1.1 Static methods, class methods,
#!/usr/bin/python# Filename:func_global.pydef func (): Global x print ' x is ', x x = 2 print ' Changed loca L x to ', XX = 50func () print ' Value of x is ', x>>>>x are 50Changed Global X to 2Value of X is 2How it worksThe global
Python has three data structures: lists, tuples, and dictionariesListing (list)Definition: A list is a data structure that handles a set of ordered items and is a variable data structure.Initialize: [], [1, 3, 7], [' A ', ' C '], [1, ' s ', ' des ',
Static methodsThe method of decorating can be changed into a static method through the @staticmethod decorator, what is static method? In fact, it is not difficult to understand, the ordinary method can be called directly after instantiation, And in
Simple ' Hello world! 'Python command lineAssuming you have already installed Python, enter it on the Linux command line:$pythonWill go directly to Python. Then, at the command line prompt >>> later enter:>>>print (' Hello world! ')You can see it
Vamei Source: Http://www.cnblogs.com/vamei Welcome reprint, Please also keep this statement. Thank you!Thank you thunder424 correctionSequence sequenceSequence (sequence) is a set of sequential elements(Strictly speaking, it is a collection of
ListTo create a list:Name_list = ['Alex'seven'Eric' ] or name_list = List (['Alex'seven' 'Eric'])In fact, the main content of today's study isIndexSliceAdditionalDeleteLengthSliceCycleContainsIndexes and slices: Flexible values can be obtained by
Python writes Excel files and requires XLWT libraries. : https://pypi.python.org/pypi/xlwt/1.1.2After download, modify the extension to RAR and install after decompression:Once the installation is successful, it can be referenced. The following code:
Static MethodsOnly nominal collation management, in fact, no property in the class or instance can be accessed in a static methodThe method of decorating is changed into a static method by @staticmethod Adorner, what is static method? In fact, it is
In Python, reflection refers to the ability to manipulate (find, delete, judge) a member (for example, a function within the module) through a string within an object (such as a module).For example, we need to call a function F1 in module s1.py, we
Python Django TemplateLink up on an articleFirst, create a template file# Cat Blog/template/index.htmlcsvthello csvtIi. Publishing template files to a view method(1) The first method:# Cat blog/views.pyFrom django.http import HttpResponseFrom django.
Set up the first function/usr/bin/env Python#coding:utf-8def add_function (A, b): = A + Print C if __name__= ="__main__": add_function (2,3)When defining a function, a parameter can be assigned to a default value as it was before, while
About Django:Django is an Open-source Web application framework written by Python. The MVC framework pattern was adopted, i.e. model m, View V and Controller C. But in Django's actual use, Django is more concerned with models, templates, and views,
Sockets are also commonly referred to as "sockets," which describe IP addresses and ports, and are a handle to a chain of communication, where applications usually make requests to the network through "sockets" or respond to network Requests.Sockets
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