Variable: (the variable is really nothing to say)Change: it changes.Volume: Measure the reality of things standardThe role of reference variable values in PythonOperating system: For software that controls hardware, define the interface of each
1. PrivatePrivate methods and private variables, the class cannot be usedThe format is to add two underscores before a variable or methodImportRedisclassMy (object):def __init__(self): self.__host='XXX' #private variables, the class is out of
Example:a truck violated the traffic rules and ran away after hitting people. Three people witnessed the scene, but did not remember the car number, only to note some of the characteristics of the car number. A said: The first two digits of the
1.re.findall ("A", "AB")A: Match rule ab: what to matchThe result is returned as a list: [' a ']2. Metacharacters: ".", "^", "$", "*", "+", "?", "{}", "[]", "|", "()", "\""." : matches any character except the line break "\ n";Import= Re.findall
What is a moduleWhat is a module
A. py file is a module
We use import to load modules into 4 general categories
1. py file
2. Package a package of modules (folders with __init__.py files)
3. Built-in module
4, has been
1. List basic Format# List class listsLi = [1, 2, 3, "SB", ["Time", [9, ten], "Huang"], 6, 7, True]#通过list创建的对象用中括号 Enclosed.#, split each element#列表中的元素可以是字符串, numbers, lists, Booleans,,, all of them can be put in .#就是 "Collection", inside can put
After a few days of basic learning, I gradually understand the Python language, it is a high-level language, but in the compilation of such high-level language needs to install a program called (interpreter), the role of the interpreter is
Before beginning the formal preparation of the aircraft war game, the Pygame provided the module to learn, the following code just to verify some features, and can not do aircraft war games.Before beginning to formally write the code must first
The reflection mechanism is implemented by Python3 built-in hasattr, GetAttr, and SetAttr. The property or method that gets the variable name based on the string form of the variable name.I. Viewing properties and methods of known objects through
Python under the matrix upside down, you can use a double loop, or a zip implementation.
Loop implementation:
Nested list derivationMatrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]matrix_t = [[Row[col] for row in matrix] for Col in
BackgroundRecent projects have reached the stage of deployment. Because the project background and algorithm are all Python "", but do not want the source code directly "release" to "Customer" where. Then began to think ...first of all , according
Python (pronunciation: English [? Pa?θ?n], beauty [? Pa?θɑ:n]), is an object-oriented, literal translation of computer programming language, but also a powerful general-purpose language, has nearly 20 years of development history, mature and stable.
Run resultsNote It's best to run under the console.#!/usr/bin/env python#-*-coding:utf-8-*-#@Time: 18-5-21 pm 3:44#@Author: LK#@File: progress bar. PY#@Software: PycharmImportSYSImport TimedefProcess_bar (precent, width=50): Use_num= Int
Tag: Return result step specifies the Assign Python int stop function# _*_ Coding:utf-8 _*___author__ = ' Pythonwu '__date__ = "2018/5/21 0:07"def interval (start,stop=none,step=1): If stop is None: Start,stop=0,start #如果没有stop值, for
Python: function namespace and scope function object: (First Class object) definition: A function is the first class of objects: function names can be used as data1can be directly referenced, plus () to rundeffoo ():Print("From foo") F=foo f ()2.
Python reads files by lineStudied: https://www.cnblogs.com/scse11061160/p/5605190.htmlFile = open ("sample.txt" for in file: Pass # do somethingfile.close ()Studied: 7970883Remove line break for inch file.readlines (): line =line.strip ('\
Write out of the crawler, certainly not only in a page crawl, as long as you want to crawl a few pages, or even a site, this time need to use the pageIn fact, the page is very simple, or http://bbs.fengniao.com/forum/10384633.html, I have to give
Defining classesCreate a bank.py, create a dedicated class for your account, have a dedicated attribute, and then let the storage, withdrawals, and other functions belong to an instance of this account classIn Python, you can use class to create a
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