Python--day6Learning to have a position, clear goals to learn. I hope I can stick to it and get something---leavesPYTHON05--Python functions, file storytelling, and modules and flask Web frameworksI. file processing and related functionsOpen (file
1. Basic numeric types: int, long, bool (true:1,false:0), float, complex2. String formatted output:PS: The string is%s, the integer is%d, and the floating-point number is%f.3. String Common functions: (String for strings)4. List (list)
·
Greatest common divisor for solving two integers (not negative numbers) (requires two numbers not being 0)When both numbers are 0 o'clock, greatest common divisor is 0.Way one: the poor lifting method1 defGCU (M, n):2 if notm:3 returnN4
Map (function name, object to iterate over)# Column group elements all add 10# map (functions to be done, traverse iteration objects) function Map () iterate through the sequence to get a list of the same number and number as the original L = [2,3
1. Install setuptools (download link can be found from https://pypi.python.org/pypi/setuptools#code-of-conduct)#Download setuptools-25.1. 6 --no-check-certificate https://pypi.python.org/packages/1f/7a/ 6b239a65d452b04ad8068193ae313b386e6fc745b92cd4
the properties of the class, which can be called member variablesa method of a class, which can be called a member function Creation of Objects-The process of creating an object is called instantiation: When an object is created, it contains three
Today, the problem of resolving the software name and version number from the URL is recorded here, mainly Python string manipulation and common regular expressions.The string in Python is an immutable sequence, meaning that a defined string cannot
This article refers to the concise python after modifying#!/usr/bin/pythonimport timeimport os# 1. the files and directories to be backed up are specified in a list.source = ['/root ', '/tmp ']# if you are using windows, use source = [r ' c \
One Math.ceil (x)Import Math1, when x is positive, as long as the number of decimal parts of x >0 +1x=5.01Print (Math.ceil (x)) #6x=5.9Print (Maht.ceil (x)) #62. When x is negative, the number of decimal parts isx=-5.9Print (Math.ceil (x)) #-5x=-5.01
collection of basic data typesSetSet set, which is an unordered and non-repeating collection of elements1 #set does not allow duplicate collection set allow duplicate list but the collection is unordered2 #For example3 #s = {1,23,23,4,55,55}4 #print
Members in a class
1. Fields
1. Static fields that access static fields through the class itself are created when the class code is loaded, without waiting for the new class name ()
2. Normal field access by object
2. Methods
All methods belong to
string FormattingThere 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. [PEP-3101]This PEP proposes a
Unique python loop statements and python statements
1. Local Variables
for i in range(5): print i,print i,
Running result:
0 1 2 3 4 4
I is the local variable in the for statement. However, in python, a local variable is defined in the same method
Easy understanding of the policy mode of the python design mode, python Design Mode
This article provides examples of the python policy mode code for your reference. The specific content is as follows:
"Policy mode" import typesclass
Summary of exception handling methods and python Handling Methods
First of all, what is an exception? exception vernacular interpretation is abnormal. In a program, it generally means that the format entered by the programmer is not standard, or the
User Logon management in the Flask framework Learning Guide
Continue to learn flask. Today we will introduce the flask login management module. Do you still remember the blog project we wrote in the previous article? The login verification code is
Simple introduction to closures in Python, simple Python closures
Closures in Python
A few days ago, someone left a message about one of them.ClosureAndre.subIs not clear. I searched at the help house and found that I did not write anything related
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