Directly on the code which has comments#Coding=utf-8Import TimeImportdatetimedefyes_time ():#Get current TimeNow_time =Datetime.datetime.now ()#current time minus one day get yesterday current timeYes_time = Now_time + Datetime.timedelta (days=-1)
JSON is becoming more and more popular, after getting the JSON-formatted string through Python, you can convert it to the DICT format by using the Eval function:>>> a= ' {' name ': ' Yct ', ' Age ': 10} '>>> Eval (a) {' Age ': Ten, ' name ': ' YCT '}
Vamei Source: Http://www.cnblogs.com/vamei Welcome reprint, Please also keep this statement. Thank you!Original chain: http://www.cnblogs.com/vamei/archive/2012/08/31/2661870.htmlNOTES: Half of the notes, dabbler levels#The 25th is about re
Because of the ability to choose an interested site for data analysis, so this time to crawl the site is Xinhua, its URL is "http://www.xinhuanet.com/", and then to analyze the data and generate word cloudRun the entire program-related code
One, my first program
Print ("Hello word! ")So Python is a very concise language, not like c,c++ and so on to write a simple applet also calls a heap of libraries. In addition, the version of Python 3 supports Chinese writing.
Second,
This article was reproduced from: http://blog.csdn.net/fhl812432059/article/details/51745226Windows7 python2.71. Open cmd in Administrator mode2. First install wheel with pip commandIf you are prompted that ' Pip ' is not an internal or external
1. Master Python's Basic grammar knowledge2. Learn how to crawl HTML pages:Processing of HTTP requests: Urlib, URLIB2, and requests (reqests Urllib and URLLIB2 are encapsulated, function equivalent to both and)The processed request can simulate a
Collection: Corresponds to the collection type in mathematics. The elements in the collection are unique and unordered.Create a CollectionMethod one: Using {}, note that Python automatically deletes duplicate elements>>> number = {1,2,3,4,3,2,1}>>>
Review last week's contentDescription: According to the vote, most students suggest a review. So give two days, students seize the time to digest well.The implementation is as follows:1. Sort a list of numbers from small to large, then write to 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,
The Configparser module takes the Configparser class For example, its operation basically divides into three kinds: 1) initializes, 2) reads the configuration, 3) writes the configuration.1. Configparser InitializationUsing Configparser preferred to
The sorting algorithm in PythonSorting is an algorithm that is often used in programs. It is generally stipulated that for two elements x and Y, if X y is considered, then 1 is returned, so that the sorting algorithm does not care about the specific
Python command to enable http. server, pythonhttp. server
If you want to use the command E: \ zpic as the download directory, then cd in cmd to this directory and execute the command:Python-m SimpleHTTPServer
The default port number is 8000. the
The metacharacters and their meanings of regular expressions.
Metacharacters
Description
\
Mark the next character, or a backward reference, or an octal escape character. For example, "\ n" matches \ n. "\ N" matches the line
Python learning 2 and python Learning
I don't want to write it the next day ~~
Come on ~~
--- Condition judgment ---
What is interesting about Python is that there is no () {}, but instead an indent control code block. The following conditions must
Socket programming,
This blog does not discuss the development history and classification of sockets. It mainly describes how to use socket to build a basic client/server architecture.
A complete computer system consists of hardware, operating
Install pip and pythonpip in Python
In Python, third-party modules are installed through the package management tool pip.
If you are using Windows, make sure that pip and Add python.exe to Path are checked during Python installation.
In the
High-order functions and decorators in python
Definition of high-order functions: a function with a function name or a built-in function name returned by the input parameter.
The simplest high-level function:
Def add (x, y, f ):Return f (x) + f
Install Numpy, matplotlib, and numpymatplotlib in Python.
Note:
Cp27 indicates python2.7 In the downloaded database name.Input import pip; print (pip. pepw.tags. get_supported () in shell to get the Supported file names and versions of pip.
======
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