This article describes the
data types for Python,
data types for PythonA total
Four species,I'll describe each of them individually:
First, we understand what the data type is
A computer is a machine that can do mathematical calculations as the
This chapter describes the
python stringTo write and deal with, before we figure out the vexing
character encodingAfter the problem, we'll study
a string of Python.
In the latest version of Python 3, strings are encoded in Unicode, meaning that
A computer can do a lot of automated tasks, because it can do its own
Conditional Judgment。 It's like studying in junior high.
if Else, if xxxxx, xxxxx, otherwise xxxxx, XXXXX, this, that is, this chapter is mainly to say if else
Conditional
In the following article, let's look at what a Python module is. Find out what Python modules are, and how the modules in Python can be used with Python programming places and roles.
Module
The Python module, which is a python file that ends with
Goal
Module
Package
Production of modules
01, Concept of Module 1.1 moduleNote module is a core concept of the Python program architecture
Each py python source code file that ends with an extension is a module
The
Inside class, you can have properties and methods, and external code can manipulate the data by invoking the instance variable directly, thus hiding the complex logic inside.However, from the previous definition of the student class, the external
is still the Python base for loop' Woeudbwieb ' for in S:#s represents an iterative object print(i)if'c ' not inch s: Print (' no c')ListEach element is separated by commas and can be placed in an arbitrary data type, orderedSlices and
Random Random characters are needed in many parts of our program, and we can generate random strings from the randomness module.Common methods are as follows:ImportRandomImportstring#returns a random number between 1-10,
PYTHONQTP, Seleniumjmeter can also realize the automation to write code, to realize the tool can not do work. Python can be developed in the background, automated operations, artificial intelligence, data analysis, crawlers, embedded development
coding
By default, Python 3 source files are encoded in UTF-8
All strings are Unicode strings
You can specify a different encoding for the source file:
# -*- coding: cp-1252 -*-
identifiers
The
1.python need to install flask, enter in command line window: PIP3 Install flask2. The code is as follows:From flask Import flask,request,jsonify,sessionusername = ' admin ' PASSWORD = ' 123456 ' verificationcode = ' 111111 ' app = Flas K (__name__)
File filesWhat is a fileFiles are used for data storage and unitsFiles are often used to store data for long periodsThe data in the file is stored sequentially in bytesProcess of file operation:1. Open File2. Read/write files3. Close the
The requests Library is a blocking HTTP request library, and when we make a request, the program waits for the server to respond until it gets a response and the program does the next step.Aiohttp can provide a library of asynchronous Web services
1 #function2 3 #Define a function # def name (): #必须加上括号 ()4 5 #return #函数里面写上return之后, the function below does not execute, the function closes immediately, return6 7 #return value: There is a return value no return value on a return value8 9
1.CPU: central processing unit, human brain, Computing center, control Center.Memory: Temporarily stores data, interacts with the CPU,Advantages: Fast reading speedDisadvantages: Small capacity, high cost, power loss disappears.HDD: Long-term
def func (): = [] = input ('username:') = input ('password: try: list[4] # This is not going to be called because the list has no elements except Exception as E: Print (E.__class__) func ()Username:11Password:1def
Want to kiss number: in the distant ancient times, people found that certain natural numbers have a special relationship: if the sum of all the factors other than itself of the two number A and b,a equals to the sum of all other factors other than
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