@property can access a Python-defined function as a property, providing a more friendly way to access it, but sometimes setter/getter is needed, why is it necessary to use functions as attributes?First, in order to provide friendly access, the
First, this is Python.For I in range (1): print ("". Join (["%d*%d=%d"% (j, I, I*j) for J in range (1, i+1)]))DetailedFor I in range (1): #当i = = 1 O'Clock: print ("". Join (["%d*%d=%d"% (j, I, I*j) for J in range (1, i+1)])) a ["%d*%d=%d"
English documents:
delattr
( object , name )
This is a relative of
setattr () . The arguments is an object and a string. The string must be the name of the one of the object ' s attributes.
In a class, self can only be used in a function, which represents an instance property, where each instance can be set to be worthless without affecting each other.If you use a property that does not have self at the class level, it is a class
The most recent spare time is mainly in the learning of Python threads, processes and the process, the first time with Python multithreading and multi-process is two months ago, it was just a simple look at a few blog post and then use, did not
We already know that list and tuple can be used to represent sequential collections, for example, the name of the class:[' Adam ', ' Lisa ', ' Bart ']Or the test results list:[95, 85, 59]However, to find the corresponding score according to the name,
The OS module provides new/delete/view file properties for directories or files, as well as path operations for files and directories. For example: absolute path, parent directory ...OS.SEP can replace the operating system-specific path delimiter. "\
At pre-boot time, the application will still call the OnLaunched method, and the Suspending event will occur immediately after the OnLaunched method call, and then the application will be paused.I'm going to start out with a functional branch based
Directory
list, tuple operations
String manipulation
Dictionary operations
Collection operations
File operations
Character encoding and transcoding
1. List, tuple operationsLists are one of the most commonly used
English documents:
CHR
( i
Return The string representing a character whose Unicode code point is the integer
i . For example,
CHR ($) returns the string
' a ' , while CHR (8364) returns
filter, map, and reduce are all processed on a set, filter is easy to understand for filtering, map is used for mapping, and reduce is used for merging. Is the Python list method of three carriages.1. The function of the filter function corresponds
#!/usr/bin/env python# coding:utf-8import os, Sysfilename= "1.txt" hang=0with open (filename) as f: for i in f: hang+=1hang=hang-100 # The last number of lines to keep num=0with open (filename) as f: with open ("new{}". Format (
Ulipad is a very useful Python editor, of course, many friends with vim or gedit can, see personal habits.
First, download the Ulipad 4.1 compressed file http://down.51cto.com/data/630118
Unzip to the/tmp/directory
cd/tmp/ulipad/
1, Collections.dequeIn Python it is possible to use a list as a queue, but it is very fast to delete or add elements from the end of the team, but it is much slower to delete or add elements from the Team's head, because the other elements in the
Python learning day 2, python Day 2Note: writing a program cannot write repetitive code learning content: data type, for loop, while loop, character encoding, File Processing 1, for loop 1, simple for loop for I in range (10): # Here: A set of data
Python built-in functions (16) -- dir, python built-in functions dir
English document:
dir([Object])
Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that
Python class attribute delay calculation, python attribute Delay
The so-called latency Calculation of class attributes defines the class attributes as a property, which is calculated only when accessed. Once accessed, the results will be cached, you
Python built-in function complex, pythoncomplex
English document:
Class complex ([real [, imag])
Return a complex number with the value real + imag * 1j or convert a string or number to a complex number. if the first parameter is a string, it will
Python built-in functions (10) -- chr, python built-in function chr
English document:
chr(
I)
Return the string representing a character whose Unicode code point is the integer
I. For example,
chr(97)Returns the string
'a', While
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