Python file processingMode of open FileFile Common functionsOne, open the file, close the fileProcess of manipulating files:# 1. Open the file, get the file handle and assign the value to a variable #2. Manipulating files by handle #3. Close
Reference:https://www.cnblogs.com/studyDetail/p/6446180.html (python的类)https://www.cnblogs.com/zunchang/p/7965685.html (面向过程和面向对象编程,推荐)http://xukaizijian.blog.163.com/blog/static/170433119201111894228877/ (python类的内置方法)The definition of a class is
Binding properties and methods to an instance object:1. Bind attributes to an instance: first define a student class
#!/usr/bin/pythonclass Student(object): pass
Then bind the properties:
s = Student()s.name = ‘AAA‘ #
ListLists are frequently used data types in Python for storing multiple values.Expressions: separated by commas within [], can hold n any type of valueeg#Single Typeusers=['Yangli','Yite','Fixd']#multiple types, list nestingusers=['room01',['Yangli',
function format for 1.python: def FuncName([arg1,arg2,..]): func_suite def: def是函数的关键字 FuncName: 实际也是变量,它指向函数对象,在函数定义时被赋值,根据习惯,这里我们成为函数名 ():()是函数运算符,引用函数时,用函数名+()引用,如: FuncName() [arg1,arg2,..]:
First, Python introductionThe birth and application of PythonThe founder of Python is Guido van Rossum (Guido van Rossum). 1989 Christmas period, Guido van Rossum (Chinese name: Uncle Turtle) in order to pass time in Amsterdam, determined to develop
It is well known that single and double quotes in Python are often used by us, such as print, input, and so on.But most of the strings that are directed to the printout are in double quotes, "hello,python! ", and single quotes more (three single
Constructors and Expressions: __init__, __sub__ common operator overloading methods
Method
Overload
Pager
__init__
constructor function
Object creation: X = Class (args)
__del__
A computer for many years of the program Ape, bring you a few programming routines and a few smart tools, hope for your way of programming, add blood back to blue, together to chop thorns, common growth. Collectively: comparisonof time, 8th brother.1
List is a type that is often used when writing test cases, let's take a look at some of the things that are commonly used in the following tables.1. shardingFunction: Extracts a subset of the elements from the list (shards are often used when
Inheritance of Classes
Related concepts:
Inheritance: The properties and method subclasses of the parent class can have direct ownership called inheritance
Derivation: New features (properties and methods) derived from
function scopeWhen the Python function runs, it creates its own scope, which is the scope (or the function has its own namespace, or namespace). When executing a function, if a variable name is encountered in the body of the function, Python first
Python learning notes-use pip to install the module, pythonpip
We often need to install various modules when using Python, while pip is a very powerful module Installation tool. Similar to linux Yum, It can automatically resolve dependencies when
Command Line execution of django source code (2.0.2), django2.0.2
Preface
The django command line is frequently used in the whole django web development and must be used. Therefore, it is very helpful to understand the command line implementation
Python day1 variable, pythonday1Python path, Day1-Python basic 1 variable
Variables are used to store reference and operation information in computer programs. They also provide a way to mark data with descriptive names so that our programs are more
Python basics 1: Python BasicsI. Introduction and version of Python
Python is an excellent and widely used language that advocates elegance, clarity, and simplicity.
Currently, Python is mainly used in the following fields:
Cloud computing:The
Dictionary Case demonstration and dictionary Case demonstration
Case: 10 students are added by name. There are three tests for Chinese, mathematics and English. The scores are randomly generated for these 10 students [50]
Requirement: print a score
Python implements the image size scaling script,
Recently, due to the need of the website for image size, I wrote a small script in python to adjust the image size. The special record is as follows:
# Coding = UTF-8 import Image import shutil import
Python built-in functions
Python built-in functionsI. mathematical operations
Abs (x)
Absolute Value1. The parameter can be an integer or a plural value.2. If the parameter is a plural value, the modulo of the plural value is returned.
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