Categories of blogs:
Essay: Everyone can be found in the blog;
Article: Others can not find, through the URL to access;
LOG: Other people can not find the URL is not accessible;
The blog inserts two forms of code:
Main content:1. Use of function names2. Closed Package3. iteratorsApplication of Function nameThe function name is a variable, but he is a special variable, with parentheses to match the variables of the executable function.1. memory address of
SysModule SYS gives you access to variables and functions that are closely related to the Python interpreter.
function/variable
Describe
Argv
command-line arguments, including the script name
everyone all know that Python is a language that is very sensitive to indentation, the code format is very strict, the personal encounter Some of the most common problems are as follows:1. Spaces or tabs should not be used where spaces or tab
Sequence Type :One-dimensional element vectors, element types can be different, access to specific elements of a sequence by subscript, string type, tuple type, list type belong to sequence typesequence Type general operators :X in S If x is the
The most important purpose of the function is to make it easy for us to reuse the same program.Some operations are subordinate to a function, and in the future when you want to implement the same operation, you can simply invoke the function name,
1. Complete exception HandlingException handling ensures that a program error is also fully operational and should not stop running for a bug, the full format of getting exceptions is described here1 Try:2num = Int (input ("Enter an integer:"))3
sequence SequenceSequence (sequence) is a set of sequential elements (Strictly speaking, it is a collection of objects, but given that we have not yet introduced the concept of "object", temporarily say elements)A sequence can contain one or more
In Python, with can significantly improve code-friendliness, such as:With open (' a.txt ') as F:Print F.readlines ()For our own class can also use with, as long as the class to add two function __enter__, __exit__ can:>>> class A:def __enter__ (self)
#!/usr/bin/Env python#-*-coding:utf-8-*-# Author:DaShuang.Gu" "Requirements:Buyers1. Product information exists in the file2. Purchased goods, Balance records. The first time you start a program, you need to record your salary, and the second time
# Set Set# collections are similar to lists, tuples, and can store multiple data, but the data is not duplicated# The Collection object also supports Union (union), intersection (intersection), Difference (poor) and sysmmertric_difference (symmetric
The calculation of the percentage of the situation, looked up, there are two waysSee the code below for specific implementations #Mode 1 is formatted as float and then processed into% format, which requires the numerator/denominator * 100 as
The dynamic parameter of a function1.*args positional Parameters Dynamic parameter transferdef Chi (*food): theprint(food) chi (" BBQ "," hotpot "," shrimp Eat shrimp shabu "," grilled fish ")View CodeMultiple positional parameters are passed in,
1. #global和nonlocal的特点类似, but nonlocal only modifies the variables that are closest to his scope, does not modify the global variables, and finds that the global is not found.2.global refers to the global variable to the scope of the local variable,
Target situationThis time our target site, is the Ajax loading data, first of all, open the Web page, directly with the browser (Firefox) with the developer tools, click on the Web, then down the page, click XHR, find the JSON data, you can see
What can I do with python? Can do daily tasks, such as automatic backup of your MP3, can do website, many famous websites including YouTube is written by Python, can do online game backstage, many online game backstage are developed by Python. It's
August 9, 2018 release, follow up comments and other text description ———————————— first need to test the code name_function.py is a simple function, get two names before and after the combinationdef get_formatted_name (first,last,middle="): if
# in C language is a static language, compiled before running, not allowed to edit code in the process of running# in the process of running, you can change, you can add properties, that is, dynamic language (python)# python dynamic Add properties
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