In the python2.x version, different types of comparisons are supported, which are compared in the following principles:Built-in type:1. Same type: 1.1) Numeric type: Contains int, float, long, complex, BOOL (the bool type is a subclass of int, and
Today we mainly learn about Python's dict (full name dictionary) and set. The usage of dict is similar to the map table in JavaScript, the key + value structure language. and set, exactly, is just a collection of keys.DictDirect Sticker Code>>> d = {
Import__ (name[, globals[, locals[, fromlist[, level]])The function that is called by the import statement. It exists primarily for you to change the semantics of an import statement with another function that has a compatible interface. Why and how
IteratorsThe objects that can be written to in the back of the For loop are iterative, such as list,dict, strings, and so on.#Fibonaccidef fib_opt (n): A,b,i=0,1,0while IPrint [Fib_opt (i) for I in range (100)] When counting 100, the first 99 are
Python is one of the best programming languages and is widely used in scientific computing: computer vision, artificial intelligence, mathematics, astronomy, etc. It also applies to machine learning and is expected.Of course, it has some drawbacks,
Python internal execution processCoding
By default, Python3 source files are encoded in UTF-8, and all strings are Unicode strings. Of course, you can also specify a different encoding for the source file:
# -*-coding:cp-1252–*-
1.
1 Object-Oriented programmingObject-Oriented Programming:Object-Oriented programming -- Object orientedprogrammingOOP takes objects as the basic unit of a program, and an object contains functions for data and manipulating data.
1.1 Get object Information1.1.1 UseType ()Judging Object Types>>> type (123)-- basic data type judgment>>> type (' 123 ')>>> type (ABS)--python built-in function judgment>>> type (DOG)>>> type (Dog ())--The judgment of the custom class, quoted
1.1 Multiple Inheritance>>> # Max class... class Animal (object):... pass...>>> # Big class... class mammal (Animal):... pass...>>> class Bird (Animal):... pass...>>> class Runnable (object):... def run (self):... print (' Running ... ')...>>>
There are two ways to format a Python string: a percent-semicolon, format-modeThe percent of the semicolon is relatively old, and format is a more advanced way to replace the old way, the two coexist.1, percent of the wayWhen formatting a string,
Second, basic useNosetest use of scripts (after nose is installed)or directories]We can use the configuration file to put the parameters that need to be run, the profile file name is Nose.cfg, is the standard profile format, as
A: IntroductionParamikois to usepythonlanguage to write a module that followsSSH2protocol that supports the connection of remote servers in an encrypted and authenticated manner. it only needs to be installed locally on the appropriate software
#需求
Users can Blur query employee information
Show how many matches, matching characters need high brightness display
#脚本内容#!/usr/bin/env python#_*_ coding:utf-8 _*_while true: info = ' Info.txt ' f = file (info )
Today, Python reads a configuration file with many fields, similar to the format in the configuration file:Pidstart:2600startfid:47starttid:450startfirst:1message: "It is common to think of:Config = open (Configpath, ' R ') for item in config://set
We've learned that Python supports Boolean types of data, with only a Boolean type True and False two values, but the Boolean type has the following operations:and Operation : Only two Boolean values are true when the result is true.True and True #
Frist Django app-3. View, fristdjango
I have already mentioned some usage of models in Django, including orm and operation APIs. Next I will take some simple interfaces to learn view-view in Django. This article mainly introduces the following two
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