Currency conversion I
MOOC University of China---"Python language Program design" operating systemDescription
The renminbi and the US dollar are one of the two common currencies in the world, writing a program for converting currencies, where:
Using Python's built-in modules to save, extract data structure objects in Python:
such as lists, dictionaries, collections, and so on.
First import the Pickle module (no installation required):
Import Pickle
To save dictionary data using
1.python Multi-threaded programming
A process is made up of several threads, and a process has at least one thread. Because threads are the execution unit that is directly supported by the operating system, the high-level language is usually built
To deploy a Python script on an online server today, the use of mysqldb, a variety of attempts to download the source code (a variety of dependent libraries are incompatible), Get/yum (this linux is really pure ah these two can not be used)
Six:six is a Python 2 and 3 compatibility library
Six is not hosted on the GitHub, but is hosted on the BitBucket, but these are not the focus, the focus is its role.
As we all know, the division of Python 2 and Python 3 has created a lot of
Each new version of ①python will add new features or make some changes to the original functionality. Some of the changes are not compatible with the old version, that is, in the current version of the code to run normally, to the next version of
From:http://www.cnblogs.com/strongyaya/p/7200357.html
There are two functions under the OS module:
Os.walk ()
Os.listdir ()
#-*-Coding:utf-8-*-
2
3 import os
4
5 def file_name (file_dir):
6 for Root, dirs,
Recently in the use of Python processing data, need to install numpy,scipy and matplotlib three packages, so download the corresponding Python version of the package, run EXE file execution. Results when running numpy EXE file error:Python version 3.
Some time ago need to crawl some data for analysis, using Python to write a crawler, the specific problems recorded below.
(i) Write code directly
The crawler is the first HTTP request, returned if the HTML page is usually parsed into a DOM tree
Write a blog when you use the paging, recorded.
From Django.core.paginator import paginator
is to use this paginator class.
Paginator (Object_list, Per_page, [Orphans=0, Allow_empty_first_page=true])
Parameter object_list (total data) and
Work overtime today Ah, bitter ah.
Boring, with Python to write a grasp of the image of the crawler, it feels very good ah, haha
First put the code: (Python version: 2.7.9)
__author__ = ' Bloodchilde ' Import urllib import urllib2 import re import
To sort the list, Python provides two methods
---sort----Method 1. Sorting using the List.sort function of list
List.sort (Func=none, Key=none, Reverse=false)Method 2. Sort by sequence type function sorted (list)
>>> list = [2,5,1]
>>> list
[2,
In Python programming, you often need to skip the first line to read the contents of a file. It is easy to think of setting a line_num for each line, and then determining if Line_num is 1, and if not equal to 1, read the operation. The corresponding
Chinese characters occupy the equivalent of two words in the character, but the font design, the general one Chinese character width does not equal to the width of two English characters, so the effect of printing is biased.
Such as:
c = ['
5.5, Python's recursive function
Inside a function, you can call other functions. If a function calls itself internally, this function is a recursive function.
For example, let's calculate the factorial n! = 1 * 2 * 3 * ... * n, represented by a
From __FUTURE__ Import Division imports the Language Feature Division (exact division) of Python's future support, the "/" operator performs truncation division when we do not import the feature in the Program (truncating division) , when we import
If you need to work with large files and do not want to rely on the database, splitting the file is also a solution. The following is a brief introduction to the Python implementation method that divides the data into months.
#引入依赖库
PD
datetime
OS
processes, Threads (threading, multiprocessing, Queue, subprocess) in Python
processes and threads in Python
Learning knowledge, we should not only know it, or know why. You do it, you are more NB than others. Let's take a look at what processes
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