The format of the simple write function and the meaning of the function prefaceBefore learning how to write code, in order to achieve the same function to write a lot of code, so there is a function, function is equivalent to a tool, function name
1Name ="My name is {name} and my age are {age}"2 3 #Capitalize first letter4 name.capitalize ()5 #count the number of a character6Name.count ("a")7 #name in the middle to print altogether 50 characters, not enough-to fill up8Name.center (50,"-")9
Algorithm (algorithm): A computational process, a method of problem solving1. Two characteristics of recursion-Call itself-End conditionComplexity of Time-time complexity is an equation (unit) used to estimate the run time of the algorithm-In
Bubbling algorithm: For the sequence to be sorted, compare two elements at a time, and if the sort is wrong, swap the two until the sorting is complete.Take the series Li = [12,22,3,11,8,10] as an example:For M in range (Len (LI)-1): For n in
Where the co-process comes in
Concurrency of large systems and easy to bottleneck in IO (disk IO, network IO), multi-threaded, multiple processes can solve this problem, of course, thread, process switching is very resource-intensive. The
1. File=open (' Xxx.txt ', encoding= ' utf-8 '), the open () function is a python built-in read and write operation for a file that returns a Stream object (not the file itself), so the method used is a method of streaming the object. It is
Transferred from: http://blog.csdn.net/u014680513/article/details/51005650# Script to register Python 2.0 or later for use with Win32all# and other extensions that require Python registry settings## Written by Joakim Loew for Secret Labs
namespace of the functionDefinition: It can be understood as a container in which many identifiers can be loaded. Identifiers with the same name in different containers do not conflict with each otherThree types of namespacesBuilt-in namespace
Remember the Yang Hui triangle you learned in high school? The specific definition is no longer described here, you can refer to the following graphics: 11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1 ... first in giving you a positive integer n, please
Give you a decimal number A, convert it to a B-number, if b>10, in uppercase notation (10 with a, etc.) A is a 32-bit integer, 2 AC:DIC = {10:'A', 11:'B', 12:'C', 13:'D', 14:'E', 15:'F'} defdectoother (num, Basic): RSL= [] whileNum! =0:mod= Int (
Today is mainly about the application of the function part ~ mainly generators and iterators ~Say the generator first:Now there's a list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and I want to add one to each value in the list now.before learning iterators >>>1
Python four days -- while exercise, python four days -- while
--- Restore content start ---
Exercise questions
1. Calculate the value of 1-2 + 3-4 + 5-6 + 7-8 + 9-10.
Problem Analysis: first write out the even and odd numbers from 1 to 10
#!
Python simple crawler crawling Baidu Post Bar pictures,
Using python to implement such a simple crawling function, we can crawl the image we want to local. (Python version 3.6.0)
1. retrieve the data of the entire page
def getHtml(url):
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