In the previous crawl through the picture has a little experience, based on previous experience again crawl Baidu Search interface imageNonsense don't say, first on the code#!/usr/bin/env python#-*-coding:utf-8-*-# @Time: 2017/7/22 10:44# @Author:
Penalty Games:From random import choicescore=[0,0]Direction=[' left ', ' center ' and ' right ' def kick (): print ' =====you kick!===== ' print ' Choose one side to Shoot ' print ' left center right ' you=input () print ' You kicked
Building a commodity class, the __INIT__ function is similar to a construction method, and self is similar to thisimport Random class goods: def __init__ (self, Name self.name = name self.price = Price def changeprice (self self.price =
Blink of an eye has passed for several years, the age is getting bigger, the previous dream is also more and more distant, considered a long time not willing to abandon their dreams, and family to discuss for a while family finally agreed to career
Why should there be tuples, () can hold multiple value tuples cannot be changed more is used to queryT = (1,[1,3], ' SSS ', (UP)) #t = tuple (1,[1,3], ' SSS ', ())Print (Type (t))Tuples can be a key to a dictionaryd={(+): ' Zcx '}Print (D,type (d),
Write CSV file source code:1 #output data written to CSV file2 ImportCSV3data = [4("Mike","male", 24),5("Lee","male", 26),6("Joy","female", 22)7 ]8 9 #Python3.4 New way to solve the problem of empty lineTenWith open ('D://write.csv','W', newline="')
A data structure: List tuple dict set1. Listlist01 = List () list01 = []A.append (object)A.extend (list)Del A[2]2. TupleContent cannot be changed, length cannot be modified TUPLE01 = (1,2,3,4)3. String4. DictKey must be an object that can be hashed (
1. Namespaces and ScopesNamespace: Where the name is stored, the exact name space is where the name and the value of the variable are bound.Namespaces have a total of three namespaces, both:1. Built-in namespaces: generated when the Python
Installing a third-party library appears Python version 2.7 required, which is not found in the registryCreate a file register.py content as follows.Import sysfrom _winreg import *# tweak as necessary version = Sys.version[:3]installpath =
1. Strip () function
Function prototypesDeclaration: S is a string. RM is the sequence of characters to be deletedS.strip (RM): Remove the beginning and end of the S string. The characters in the RM delete sequenceS.lstrip (RM): Removes the
First, the Python line of code:
1 name = "Hello, world" 2 print (name)
Second, variable:
1 name = "SunDM12" 2 name2 = Name3 print ("My Name:", Name, name2) 4 5 name = "Wangba" 6 print (name, name2)
Name changes, and name2 = name has assigned "SunDM1
First, Introduction
Used to generate and modify common configuration documents, the name of the current module is changed to Configparser in the Python 3.x version.
Second, the configuration file format
[DEFAULT] Serveraliveinterval = 45Compression =
Shelve
Shelve is a simple data storage scheme, he has only one function is open (), the function receives a parameter is the file name, and then return a shelf object, you can use him to store things, you can simply think of him as a dictionary,
Learn a period of time flask, but has not done the deployment, so think about how to deploy it, think, first bar service to straightened out bar, so it is to think about the service to get up, here to choose is
Flask+uwsgi+nginx+ubuntu, Python is
1, there are four numbers: 1, 2, 3, 4, how many can be composed of different and no repetition of the number of three digits? What's the number? 2. The bonus awarded by the Enterprise is based on the profit commission. Profit (I) less than or equal
1. Select the address where the project is stored by default
The default address is C:\Users\Lee, which is the address of the CMD console, and after the project is created, the command django-admin startproject project_test default address creates
Packaging
1. Why encapsulation?
Encapsulation is to hide the specifics of the details of the data properties and methods, providing only one interface. Encapsulation can be used without caring about how the object is built
2. Encapsulation includes
Basic Requirements:User Portal2. Press Q to exitRealize:1. Use the list and dic2. If judgment while and for loop3. Use documents to record product information and shopping records" "Shopping Cart User Portal1, the product information exists in the
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