Python Data type number
Integer type (int)
Long Integer type 207000000000000L
Float type (float) 2.7
Complex Type (complex) 1+2j
In Python3, an int type can hold an integer of any size, and as a dynamically
List of Python data typesA list is a collection of data defended in square brackets "[]", with different members separated by ",". The list can contain any data type, or it can contain other lists, which can be accessed by the list by ordinal. You
User directory due to perennial users upload pictures more, resulting in hard disk resources will be exhausted, but customers require at least one months to save files,However, the folder of hundreds of thousands of pictures, whether open, sort
I. Some points of attention on the Hashlib moduleThe Hashlib module is used to encrypt related operations, instead of the MD5 module and the SHA module, mainly provides SHA1, SHA224, SHA256, SHA384, SHA512, MD5 algorithm;MD5 generates a 32-bit 16
Crawler in the development process also has a lot of reuse process, here to summarize, in the future can save some things.1, basic crawl web get methodimport urllib2url = "http://www.baidu.com"response = urllib2.urlopen(url)print response.read()Post
Execution mode:
Enter Python directly into the command line for single-line input execution, exit and not save.
Python filename.py or./filename.py Execute script file directly
Script format:
#! /usr/bin/python Specifies
Typically, Python scripts are always executed in sequence, but for some complex programs, you may want to skip the other part of the statement by choosing to execute a portion of the statement depending on the circumstances that occur during
Regular expressionsStrings are the most data structure involved in programming, and the need to manipulate strings is almost ubiquitous. For example, to determine whether a string is a legitimate email address, although it can be programmed to
Common Module Time Module time.time ()Import Time Import datetime Print # returns the timestamp of the current timeTime.ctime ()Print # Convert timestamp to string format wed Feb 17 11:41:27 2016, the default is the timestamp of the current system
The first step is to build the development environmentThird-party libraries required:Aiohttp, asynchronous WEB development framework; JINJA2, front-end template engine; aiomysql, asynchronous MySQL database driverRequired built-in libraries:Logging,
Such as:
>>> Print ord (' a ')
97
>>> Print Chr (97)
A
Below we can start to design our case-and-write program:
Copy the Code code as follows:
#!/usr/bin/env python#coding =utf-8 def ucasechar (CH):If Ord (CH) in range (97, 122):Return Chr (ORD
Note that a character array is passed in, and the compiler strips out all the corresponding characters at both ends until there are no matching characters, such as:
Copy the Code code as follows:
TheString = ' Saaaay Yes No yaaaass 'Print
Example one: Use Httplib to access a URL and get the returned content:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Import
HttplibConn
=
Httplib. Httpconnection
1. First VC + + DLL's export function is defined as the export function of standard C:
Copy CodeThe code is as follows:
#ifdef Lrdlltest_exports
#define LRDLLTEST_API __declspec (dllexport)
#else
#define LRDLLTEST_API __declspec (dllimport)
#endif
A 3-level nested list M
M=["A", ["B", "C", ["inner"]]
Need to parse to a basic data item A,b,c,inner
Basic method of fetching data items:
For I in M:
Print I can only take out the first layer of a, and a 2-layer nested list ["B", "C", ["inner"]
There is a telnetlib in Python that works by setting up a Telnet entity to the host, then transmitting commands to the host (just as you would with a keyboard) and receiving data from that connection. Using it, we can turn all of the model 1 from
Python Getting Started tutorial from:http://www.cnblogs.com/taowen/articles/11239.aspx Author: Taowen, Billrice
Lesson 1 ready to learn the environment of Python
The download address is:
www.python.org
I won't talk about the Linux version, because
Dis-disassembler for Python bytecode, that is, the Python code is disassembled into bytecode instructions.
Super easy to use:
python-m Dis xxx.py
Python code is compiled into bytecode, and then by the Python virtual machine to execute bytecode,
Deep understanding of python function recursion and generator, deep understanding of python Recursion
1. What is recursion?
If a function contains a call to itself, the function is recursive. Recursion is an algorithm widely used in programming
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