Guess Age:Set your age in the program, and then start the program to let the user guess, after the user input, according to his input prompts the user to enter the correct, if the error, the hint is guessed big or small. 3 chance to guess the wrong
1. String Although you can look up values as a list by subscript, but you cannot assign values directly like lists2. View the default encoding commands under Windows CHCP General return to the active code page: 936 (corresponding to gbk2312)3. The '
Python Multi-processBecause the Gil exists in Python, so the performance of multithreading is not good, so you want to fully use the multi-core CPU resources, you can use multi-process.1.Process classThe process class is used to create theClass
Refer to Beef Cattle blog:# # #参考博客1601. Set Definition:The set itself is an element that is not duplicated and unorderedA, S=set () #定义空的集合B, s2={' 1 ', ' 2 ', ' 3 '} #没有冒号的 is set, non-empty collectionIf you want to go to a list, you can simply
One, single character match
character
function
.
Matches any of 1 characters (except \ n)
[ ]
Match the characters enumerated in []
\d
Match number, which is 0-9
The example here is that I used homebrew to install python3.6.1, to create a symbolic link that creates a python3 command to achieve the purpose of using my own installed Python3. Instead of modifying the path, the executable file or symbolic link
Import Randomimport datetime# Select Sort def getmaxindex (index, LS), int: "" ": Type ls list:type index:int:return:" "" # Select Rows The order is initially considered the largest maxindex of the current number = Indexlength = Len (ls) for I in
ConfigparserConfigparser module for operating configuration filesNote: parser translated into "analytic" meaning.The format of a configuration file is similar to a Windows INI file and can contain one or more sections (section), each of which can
OS modules are an interface between Python systems interacting with the operating systemOS.GETCWD () Gets the current working directory, which is the directory path of the current Python script work os.chdir ("dirname") To change the current script
While compared to forThe For loop is used on a number of cycles.While loops are used with conditional control, and if are more similar.While loop, until the expression becomes false (or there is a break) before exiting the while loop, the expression
Module 1. What is a module 最常见的场景,一个模块就是包含一组功能的python文件,例如module.py,模块名是module 可以使用import module,四个通用类别: 1、使用python编写的.py文件 2、已被编译为共享库或DLL的C或C++扩展 3、把一系列模块组织到一起的文件夹(注:文件夹下有一个__init__.py文件,改文件称之为包)
A list is a mutable type of data structure that is defined using the brackets.strings are defined in quotation marks, and tuples are defined with parentheses, and the list is defined using brackets.In [27]: list1=[] #创建一个空的列表In [28]:
1. More interesting, you can constantly refresh the specified URL2. Source code:#!/usr/bin/env Python3#-*-coding:utf-8-*-ImportWebBrowser as WebImport TimeImportOSImportRandom Count= Random.randint (5,7) J=0 whilejcount:i=0 whileI: Web.open_new_tab (
# -*- coding:utf-8 -*-class stack (): #初始化栈, and given the size of the stack def __init__ (self,size): self.stack=[] self.size=size self.top=-1 #判断栈是否满了, full return true def full (self): if self.top== (self.size-1): return true else:
Python re module, pythonre
1. Single Character matching
Character
Function
.
Match any 1 character (except \ n)
[]
Match the characters listed in []
\ D
Match Number, that is, 0-9
\ D
Flask Study Notes-database (Python3.6), flaskpython3.6Python database framework
Factors for selecting a database framework:
Project Structure Construction
Application
|____ Application web directory
|____ Manage. py script data
|____ Runserver. py
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