9-9. py Thon document string. Go to the directory where the python standard library is located. Check each. py file to see if there is any_ Doc _ string. If yes, sort the format properly.ProgramAfter the execution is completed,Beautiful list. lists
Go directlyCode
''' created on 2010-12-11 @ Author: Administrator ''' from random import randint, choice from string import lowercase from sys import maxint from time import ctime DOMs = ('com', 'edu ', 'net', 'org ', 'gov') dtstr = '' for
7-3 (c) displays the keys and values in the dictionary in alphabetical order.
Def sortdict (dict1): ValueList = dict1.values () ValueList. sort () dict2 = {} for value in ValueList: for key in dict1: If dict1 [Key] = value and key not in dict2:
7-10. Encryption
Def rot13 (Info): infolist = [] for C in info: If C. isalpha (): cnum = ord (c) if (65
7-13. Random Number
# Filename: test7-13.pyimport randomdef createset (): S = set () M = random. randint (1, 11) For I in range (m): S. add
This article is reprinted. Please indicate the source for reprinting.
Address: http://blog.csdn.net/mayflowers/article/details/1568852
@ Mayflowers Thank you ~~~
1. Use Chinese in PythonThere are two default strings in Python: Str and Unicode. In
I just made a website using python as the background language. It took me some time to publish the website to Windows as the test server. Record the problem.
Step 1. Download and install apache2.2
Step 2. Download and install python2.7
Step 3:
In Python socket programming, TCP and UDP programming is used. The following two different programming methods are used to send information from the client to the server,
The server returns the current time and received information of the customer
This script (via SMTP Mail Server) sends a test email to the destination address, and immediately (via pop)
Email is received from the server. To make the program work normally, you need to modify the server name and e-mail address.
'''
To use python in Apache on Windows, you must first install Apache and python. Apache I use XAMPP, while Python searches for the download link. This solution is implemented by installing the Apache module mod_python, while the current version 3.3.1
The queue module can be used for inter-thread communication to share data between threads. Now, we create a queue
The producer (thread) places the newly produced goods for the consumer (thread) to use.
In the following example, we will
8-9 Fibonacci series. the Fibonacci sequence is like 1, 1, 2, 3, 5, 8, 13, 21, and so on. that is to say, the next value is the sum of the first two values in the sequence. write a function. Given N, the return value is the nth Fibonacci number.
#
9-15. copy the file. The system prompts you to enter two file names (or use command line parameters). Copy the content of the first file.
To the second file.
#filename:test9-15.pydef copyfile(): fs=raw_input("source file:").strip()
This script mainly captures resources from the Internet and saves them to local files.
The retriever class in the script is responsible for downloading pages from the web, parsing links in each document, and adding them as necessary.
"To-do"
Document directory
1.1 function programming tools
1 List
There are other methods for listing data types. The following are all the methods for listing objects:
Insert (I, x) ---- insert an item at a specified position. The first independent
The final work needs to deal with HTML data, and then use htmlparser to find a lot of information on the Internet.
Record your achievements here and hope they will be useful to you.
1. First, let's take a look at htmlparser.
Htmlparser of the
The power of PIL lies in its many and complete functions for processing images, which can basically meet our requirements. Especially for batch processing, Pil must be faster than a piece of PS.
So we should use Pil to improve my efficiency. Below
Learning Python 1.1...
Statement:Part of the content in this article is listed below the blog of copy arrogant OX:
3 4 5 6 7 8 9 10 ==> http://harmony.relax.blogbus.com/logs/12303417.html
12 ====> http://my.chinaunix.net/space.php? Uid = 1721137 &
This article is my learning notes for the basic Python tutorial (version 2nd.
Install Python
Install python in Windows
Open your browser, visit www.python.org and click Download. Select Windows installer to download and install it. Then, the
Sequence is the most basic data structure in Python. The index of the sequence starts from 0. Python has six built-in sequences, including list, tuples, strings, Unicode strings, buffer objects, and xrange objects.
2.1 General sequence
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