In this paper, the usage of raw_input in Python is introduced in detail, and the data can be read by using Raw_input, which is convenient for the bundle console. Examples of specific uses are as follows:
1. Input string
#13222319810101 * * *
Measured the simplest performance of the Django, flask, bottle, Tornado frameworks themselves. Completely silent about Django's performance.
Django, flask, bottle all use Gunicorn+gevent startup, single process, and turn off debug, the request
Python's pursuit of simplicity, the birth of a number of operational assignment rules, and strive to simple, including two or more variable exchange values.In common language
Copy Code code as follows:
# declaring variables
A=50
b=10
#
Python operators are similar to other languages
(For the moment, we only understand the basic usage of these operators, so that we could expand the later content, the advanced application is temporarily not introduced)
Mathematical operations
In this paper, the principle of Python interpretation is analyzed in detail, which can help to understand python in depth. The specific analysis is as follows:
First, the interpretation performed here is relative to the compilation execution. As we
This example describes the use of __call__ in Python and shares it for your reference. The specific methods are as follows:
Let's take a look at the following sample code:
#call. py A class is loaded in the case.
class Next:
List = []
Python operators are similar to other languages
(For the moment, we only understand the basic usage of these operators, so that we could expand the later content, the advanced application is temporarily not introduced)
Mathematical operations
Problem
Defines a one-dimensional array of int, consisting of 40 elements that store the scores of each student, looping to produce a random integer between 40 0~100,(1) store them in a one-dimensional array, and then count the number of students
About tuples, this term is involved in the last lecture. This tells the story in its entirety.
Let's look at one example:
>>> #变量引用str
>>> s = "abc"
>>> s
' abc '
>>> #如果这样写, it will be ...
>>> t = 123, ' abc ', ["Come", "here"]
>>> t
(123,
The example of this article is about the simple realization of Python single linked list, sharing for everyone's reference. The specific methods are as follows:
In general, to define a single linked list, first define the linked list element. It
In Python, a function can be passed as a parameter, but it can also be assigned to other variables (like JavaScript, or function pointers in C + +);
Similar to Javascript,python support function nesting, JavaScript nesting function application mode
A recent requirement is to execute the shell command on the page, the first thought is Os.system,
Copy Code code as follows:
Os.system (' Cat/proc/cpuinfo ')
But the results of a printed command on the page 0 or 1, of course,
The example of this article tells the Python network programming, share for everyone to reference.
The specific methods are as follows:
The service-side code is as follows:
From Socketserver import (TCPServer as TCP,
This article describes the Python Renren login application of the implementation method, share for everyone to reference.
The specific methods are as follows:
Import re import urllib import urllib2 import cookielib import datetime import time
This article describes the Python implementation of the Web from a URL to crawl the document method, share for everyone to reference. The specific methods are analyzed as follows:
The instance code is as follows:
Import urllib
doc =
This article describes the Python use of Cpickle module serialization method, share for everyone to reference.
The specific methods are as follows:
Import cpickle
data1 = [' abc ', 12,23] #几个测试数据
data2 = {1: ' aaa ', ' B ': ' Dad '}
data3 = (1
This article describes the Python use of Marshal module serialization method, share for everyone to reference. The specific methods are as follows:
Let's take a look at the following code:
Import marshal
data1 = [' abc ', 12,23, ' jb51 '] #
This article is a simple example of the use of sets modules in Python, shared for everyone to reference.
The specific methods are as follows:
Import sets
Magic_chars = sets. Set (' Abracadabra ')
print magic_chars
poping_chars = sets. Set ('
The example of this article describes Python based on XML parse to realize the method of parsing cdatasection data, share it for everyone's reference.
The implementation methods are as follows:
From xml.dom.minidom import * implementation =
Properties of the file
Attributes are things that can be obtained from a file object.
Copy Code code as follows:
>>> f = open ("131.txt", "a")
>>> F.name
' 131.txt '
>>> F.mode #显示当前文件打开的模式
A
>>> f.closed #文件是否关闭, if
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