''' [Program 61] Question: print out the Yang Hui triangle (10 rows required for printing) 1. program Analysis: ''' if _ name _ = '_ main _': a = [] for I in range (10):. append ([]) for j in range (10): a [I]. append (0) for I in range (10): a [I] [
Python contains six built-in sequences:List, tuples, strings, Unicode strings, buffer objects, xrange objects
This article mainly discusses the two most common types: List and tuples.
URL: http://www.cnblogs.com/archimedes/p/python-list.html.
The
Chapter 8 standard library II
The second part covers many advanced modules that can better meet the needs of professional developers. These modules rarely appear in small scripts.8.1 output formatting
The Reprlib module provides a customized version
Problem description:
The Python version I used is 3.4.
Here is a program and explanation result:
Error message:
SyntaxError: invalid syntax. VcD4KPHA + signature/Signature + Kyu7avv725/cC0tcS0 + signature + HT77eotO3O86O/Signature + signature/
Random. randomRandom. random () is used to generate a random number of points 0 to 1: 0
Random. uniformRandom. uniform (a, B) is used to generate a random number of characters in a specified range. One of the two parameters is the upper limit and
The topic of this chapter is numbers in Python. Here we will detail each numeric type, their various operators, and built-in functions used to process numbers. At the end of this chapter, we briefly introduce several modules used to process numbers
6.7 remarks
Sometimes there is a data type like "record" in Pasca and "data body" in C that is very useful. Set some data items. An empty class definition can be clearly displayed:
Class Employee:
Pass
John = Employee () # Create an empty
Get a worksheet
table = data.sheets()[0] table = data.sheet_by_index(0) table = data.sheet_by_name(u)Get the value of the whole row and the whole column (returned array)Obtain the number of rows and columns6. Get CellsWhen I used it
Form request, post, get
First, let's take a look at the Request object, which contains some useful information. It is no stranger to anyone who has learned B/S development, let's take a look at how Django is implemented:
Attribute/Method
Knowledge Point: exclusive or operation
Idea: for example, the number B ^ B = 0
A ^ 0 =
Therefore, all numbers in the array can be exclusive or, And the eventually exclusive or result is the number a that appears only once.
Code:
ret = i
A lot of code has recently shared this question. The question is about object-oriented or functional programming. The following is an example of PYTHON implementation.
Copy codeThe Code is as follows:#! /Usr/bin/python# Encoding: utf8
'''The Game of
A dictionary consists of multiple keys and their corresponding values (the key-value pair is an item). Each key and its value are separated by a colon, items are separated by commas (,), and the entire dictionary is enclosed by a pair of braces. The
Stores strings separated by commas in a field and returns a corresponding list.
Copy codeThe Code is as follows:From django import formsFrom django. db import modelsFrom django. utils. text import capfirstFrom django. core import exceptions
Class
List comprehension is used to generate a list more conveniently ).
For example, if you want to multiply the value of each element by 2 and generate another list, the following method is used:Copy codeThe Code is as follows:#-*-Encoding: UTF-8
4.4 packages
A package is a way to create a module namespace by using the "vertex Module name. For example, module A. B indicates that A sub-Package B is designed under the package. Just as the application of the module saves the authors of
After python3.3, The multiline Regular Expression matching seems to have been modified. It cannot match a multi-line regular expression with non-escape characters.
The following error is reported:
>>>Traceback (most recent call last ):File"
",
1 basic exampleA common practice is to provide parameters when creating a process to tell him what to do. In this example, the output "worker" will be printed five times, but it is unclear whether it is the first or not, because every process is
3.5 dictionary
Another data type defined in python is dictionary. In other languages, dictionaries may be defined as "Composite memories" or "Composite arrays ". Unlike sequences that can be indexed by numbers, it is a constant type of keyword keys
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