1. Constant naming rulesIn Python, the variable name indicates that a variable is a constant, usually in the form of a full capitalization, such as:' 127.0.0.1 ' '3306'2. Python compilationPython first compiles the source file (. py) into a
1. Underline _ represents the value of the last expression. Note: Only useful in the interpreter, showing the results of the previous operation. 2. The print statement can be formatted with%, similar to C. such as: >>> print '%s is number%d! '%
First, the default parameters:The default parameters can simplify the invocation of functions, and when setting default parameters, there are a few things to note:1, the required parameter before, the default parameter is behind, otherwise the
1. There is no concept of constants in Python, such as Pi. Typically, the variable name capitalization defaults to constant, but it can still be changed.2. Python 3.x or later versions of. pyc files are moved to the __pycache__ folder. A program
1. About the Python program execution principle:?? Create a new Python file named auth.py, and then invoke the file from another Python file.Python Run Process:Python first compiles the code (. py file) into a bytecode-pyc file that can be read by
Recently saw an example of a decorator, not read,#!/usr/bin/pythonclassDecorator (object):def __init__(self,f):Print "Initial Decorator"f ()def __call__(self):Print "Call Decorator"@decoratordefFun ():Print " in the fun"Print " After"Fun ()See the
Each statement in the program ends with a newline character you can use the continuation character (\) backslash to divide the long statement into linesWather_is_hot = 1; Watherer = 0; if (Wather_is_hot ==1) and (watherer==0): Print ("The water in
Implementation method One:
Use Pyhon's OS module with Os.listdir (); Os.pah.isfile (); Os.path.isdir (); Os.path.join () Methods for manipulating files and directoriesIdeas:From the top down, layers of search, each iteration to determine the
In python, the output of the dictionary is the same as in JSON format, but the dictionary format is a dictionary, and the JSON format is a string, so it is used when transmitting (especially web pages). Important Functions
encode : Put a
#!/usr/bin/env python#-*-coding:utf-8-*-"""@desc: Delete Mail We add more test scenarios, such as: delete mail, find mail, send mail, etc."""ImportUnitTestImportOSImportSYS fromSeleniumImportWebdrivercur_dir=os.getcwd () sys.path.append
First, prefaceThere is a small harvest to do this problem, about Digital root solution, there is a very convenient small formula:
Second, the title 258 Add DigitsGiven a non-negative integer num , repeatedly add all its digits until
Objective:As a serious fanatic of deep learning, after studying various theories, he has been trying to learn the framework of deep learning through project practiced hand and the knowledge of structure used in actual combat. The wish is good, but
First, prefaceHave done two questions to slowly get the leetcode operation.Ii. Title 349 intersection of two ArraysGiven the arrays, write a function to compute their intersection.classsolution (object):defintersection (self, nums1, NUMS2):""": Type
First, prefaceFor this kind of abstract problem there is self usage, but also more practice, this question is to refer to other answers to do.Second, title 104 Maximum Depth of binary TreeGiven a binary tree, find its maximum depth.The maximum depth
The cognition and application of stringCognition 1: The concept of a stringWhat is cognitive 2:acii Unicode UTF8?Python default file encoding is ASCII1. Len's Considerations (decode () need testing)>>> len ("Analysis")4>>> Len (U "Analysis")22.
Python provides a summary of file operations,
Open a file
Operation File
1. When opening a file, you must specify the file path and opening method.
Open Mode:
R: Read-OnlyW: Write onlyA: append
"+" Indicates that a file can be read and written
Build a python Development Environment graphic tutorial (install Python, pip, Interpreter) under Win7 ),
Install Python
1. Download Python suitable for the System Version
First visit web site (http://www.python.org/getit/) download for your own
New Tax calculator Python script and calculator python scriptNew Tax calculator Python script
New Tax calculator (Python): a beginner script that is extremely simple and does not handle troubleshooting. It is sent only for you to enrich your
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