1. ModuleModule: A python code a set of C language code a bunch of ready-to-use functions, classesFunction of the module: Save memory consumptionModule classification: Built-in Module expansion Module custom module2. Common Modules##########
1. Dictionaries :Is the only mapping type in Python, which consists of key-value pairs enclosed in {}, and key is unique in Dict. At the time of saving, a memory address is computed based on key, and then the key–value is stored in this address.
Representation of string strings in PythonThe string has a total of 4 representation methods
Use a pair of single quotes to denote' Python '
Use a pair of double quotation marks to denote" Python "
Use a pair of three single quotes
Get the current date format in source python: https://www.cnblogs.com/wenBlog/p/6023742.html#!/usr/bin/python# -*- coding: utf-8 -*-import timeprint (time.strftime("%H:%M:%S"))## 12 hour format ##print (time.strftime("%I:%M:%S"))import timeprint
One, while loop, the use of continue, break statements in a while loop1. While loop statement:While condition:code blockExecution process: Determine whether the condition is true, if true, execute the code block, continue the next cycle, continue to
Method One:Derivation formuladd="ewq4aewtasddsfdtfdswqrtewtyufashas"print for in DD}Method Two:CounterImport COLLECTIONSDD="ewq4aewtasddsfdtfdswqrtewtyufashas"= Collections. Counter (DD)print objMethod Three:Similar to the method
The function calls itself inside itselfThe wireless loop will be error-free, so a definite end condition is requireddef Calc (n): Print (n) calc (n) Calc (10)def Calc (n): Print (n) if int (N/2) = = 0 :return nreturn calc
---restore content starts---I. Data types and Variables summary1, variable and immutable modified variable value, the ID is not variableVariable: id invariant list, dictionaryImmutable: ID changed string, number, meta-ancestor2. Order of
Python file processing open file F = open ("path", "mode")
R modeOpen in read mode, navigate to the beginning of the file, default mode. File does not exist direct error, file can only read, cannot write.
r+ modeOpen in a read-write
The import statements in Python are for importing modules, and there are a large number of modules available in the Python module library, which you need to import into the current program using an import statement.Import Statement functionThe
Implicitly-based class objectEach Python class implicitly inherits an objectFull-Text Code example implementation: enumeration of Poker's suit and card face valueOne, _init () __ Method: Object InitializationDisplay instead of implicit: __init () __
One, character encoding and transcoding1. In Python2 the default encoding is ASCII, python3 default is Utf-82.unicode is divided into utf-32 (4 bytes), utf-16 (accounting for two bytes), Utf-8 (1-4 bytes), so utf-16 is now the most commonly used
System environment: WIN10 64-bit system installationPython basic Environment configuration does not do too much introductionWindows environment installation scrapy need to rely on Pywin32, download the corresponding Python version of the exe file to
The cycle is that the computer repeatedly help us do one thing, people hate to do the repetition of dull things, like the grind, people feel boring, and then have a donkey, a circle of cycle, people a lap of a circle of push not exhausted, so the
Schema.dump and Schema.load
The Schema.dump () method returns an Marshresult object, marshmallow the official API says that the dump and load methods return all Dict objects, but to view the source code, the Marshresult object is a namedtuple.#
List
Operation
List
Method
Example
Increase
List.append (obj)add element to end
eg.>>> list1=[' hello ', ' world ', ' How ', ' is ', ' you '>>> list1.append ('! ')>>> List1[' Hello ', '
#-*-Coding:utf-8-*-"""Created on Sat June 30 14:49:22 2018@author: Zhen"""Import NumPy as NPA = Np.array ([[1,2,3],[11,22,33]])b = Np.array ([[4,5,6],[44,55,66]])# arrays are concatenated into matricesc = Np.c_[a,b]r = np.r_[a,b]Print ('-------------
There are many programming languages, but each language has a corresponding keyword, Python is no exception, it comes with a keyword module for detecting keywords.Keyword listEnter Python interactive mode to get a list of keywords:>>>Import Keyword>>
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