Two versions of python2.7 and python3.5 installedpython2.7 first install the download ReadLine:Py-2-m pip install Pyreadline650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/89/18/wKiom1gHNcWAuAjFAADb1cogOfY708.png-wh_500x0-wm_3 -wmp_4-s_163
What is an operator>> in Python, we have symbols that manipulate one or more numbers or stringsWhat are the operators>> Our common operators in Python are: + 、-、 *,/, * *, ,! =,//,%, &, |, ^, ~, >>, =, = =, not, and, orHow to use Operators>>> # ' + '
1>>> name ="I Love my job!"2>>> name.capitalize ()#Capitalize first letter3 'I Love my job!'4>>> Name.count ("o")#count the number of letters526>>> Name.center (50,"-")#output 50 characters, not enough to "-" completion, and name in the middle; Name.
function in the definition, by the parameter before the asterisking number, passing in a number of arguments into an object, a tuple or a dictionary, it can be said that these parameter values are collected.
Parameter with an asterisk indicates
Introduction: Daniel often says reading the source code is a very inefficient way to learn. But for my generation, reading source code is a good way to master programming ideas and coding norms. In short, read the source code is not omnipotent, do
Preparatory work
To ensure that the class is a new class, you should put the _metaclass_=type into the beginning of your module.
Class NewType (Object): Mor_code_hereclass oldtype:mor_code_here
In this two class Newtype is the new class, Oldtype
Python's namespace is something the Python program ape must understand, and learning about the Python namespace will allow us to essentially master some of the trivial rules in Python.
Next I will reveal the nature of the Python namespace in four
One, package name, module name, local variable name, function name
All-lowercase + underline hump
Example:this_is_var
Second, global variables
All caps + Underline hump
Example:global_var
Third, class name
First-Letter Capital
Python type conversion
Function description
int (x [, Base]) converts x to an integer
Long (x [, Base]) converts x to a long integer
Float (x) converts x to a floating-point number
Complex (real [, Imag]) creates a complex number
STR (x) converts
When I recently backed up the photos on my phone, I felt a bit of a hassle with purely manual operation and wanted to write a script to do it automatically. Some photos have been backed up before, so there is a need for a weight-back operation.
The
Python global variables and local variables
#Python中的变量: Global variables and local variables #在很多语言中, when declaring global variables, like to define the name of the global variable as uppercase #定义学生人数为100STUDENT_NUMBER = 100# School name
Python django multi-level business tree structure Planning and page rendering, pythondjangoOverview:
In the project, the Parent-Child structure is not uncommon. If there are only two tree structures, we can use the foreign key design of the database
Python built-in functions (7) -- bytearray, pythonbytearray
English document:
Classbytearray([Source[,Encoding[,Errors])
Return a new array of bytes.bytearrayClass is a mutable sequence of integers in the range 0 bytesType has, see Bytes and
Python built-in functions (8) -- bytes, pythonbytes
English document:
Classbytes([Source[,Encoding[,Errors])
Return a new "bytes" object, which is an immutable sequence of integers in the range0 .bytesIs an immutable versionbytearray-It has the same
Python screen code and function details, python function details
Let's talk about the code for implementing the python screen first. The specific code is as follows:
from selenium import webdriverimport timedef capture(url,
Use the Python script to detect problems and solutions for batch website survival.
During the penetration test, there was a large project with hundreds of websites. In this way, you must first determine which websites are normal and which websites
Django model removes the unique_together error solution, djangomodelunique
This is the case. I have a table that stores the exam.
class Exam(models.Model): category = cached_fields.ForeignKeyField(Category) name = models.CharField(max_length=128)
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