If you have any questions, add the QQ group.14670545Discussion
Python-2.7.3 can coexist with ironpython. Next we will install Python-2.7.3
: Thunder: // token
Or:FTP: // jb51user: www.jb51.net@xl.jb51.net: 8021/200907/tools/python2_jb51.rar
,
The Python language contains six built-in sequences. There are two main types: List and metadata. The list can be modified, but the tuples cannot. If you want to add or delete some elements, you can only use the list. To restrict some elements, you
1. Read the file content
Filepath = "file path" (lambda F: (F. Read (), F. Close () (file (filepath) [0] 2. Write the content to the file
(Lambda F, D: (F. write (D), F. close () (file (r 'd:/a.txt ', 'w'), 'Data to be written ') 3. Filter files
The glob module is one of the simplest modules with very little content. You can use it to find the path name of a file that complies with specific rules. It is similar to searching files in windows. Only three matching characters are used for
The Python language is very comfortable and has simple syntax,CodeVery short. I used to finish reading an entry book at noon, so I found some information on the Internet, imitated and wrote a web crawler. I used to write it in C, the amount of code
A. Comparison between native SQL statements and asq statements
Suppose there is an SQL query statement:
Select ID, IP, CH, date from TBL group by CH, date;
To use the group_by method of the asq module of Python, You can implement the
The Domain Name System (DNS) is a distributed database used to replace the host name with an IP address.
There are two reasons for DNS:
(1) It makes it easy for users to remember their names, rather than pure IP addresses;
(2) allow the server to
Dynamic addition of class attributes or member functions in Python
We sometimes need to add attributes or methods to classes dynamically. For example, we can use this method when doing plug-ins. Use a configuration file to specify the modules to
Character encoding in python2.x is a headache, but it has been solved for a long time. When I browsed the web page today, I saw that pythoner was asking about Python encoding, write a write encoding problem. The record is as follows:
First
Python 2.4 or later.
Two call methods:1. Without Parameters@
Def F ():
Python will finally handle the following:F = a (f)
, Which can be expanded:@
@ B
@ C
Def F ():
Finally, python will handle the following:F = A (B (C (F )))
2. With parameters:
In python, Excel can be operated through COM. The most common cross-platform method is pyexcelerator. for usage of pyexcelerator, refer to limodou's "using pyexcelerator to read and write Excel files". However, Gae and Django do not directly export
The function for formatting the date and time in python isDatetime. datetime.Strftime ();The functions converted from string to date type are:Datetime. datetime. strptime (),Both functions involve formatted strings of date and time, which are listed
The copy module is used to copy objects. This module is very simple and provides only two main methods:Copy. CopyAndCopy. deepcopyIndicates the shortest copy and the deep copy respectively. What is light replication, what is deep replication, and
Document directory
Marshal. Dump (value, file [, Version])
Marshal. Load (file)
Marshal. dumps (value [, Version)
Marsahl. Load (string)
Sometimes, you need to save an object in the memory to the disk persistently, or serialize the object to
In the python standard module, multiple modules are used for data compression and decompression, such as zipfile, Gzip, and bz2. I introduced the zipfile module last time. Today I will talk about the zlib module.Zlib. Compress (string [, level])
Run the following code:
#! /Usr/bin/ENV PythonS = "Chinese"Print s
This problem has been frequently encountered recently:
Problem 1: syntaxerror: Non-ASCII character '\ xe4' in file E: \ coding \ Python \ untitled 6.py on line 3, but no encoding
Document directory
Stack implementation
Python captures the latest blog list of oschina
An email generator written in Python
Stack implementation
#!/usr/bin/env python #coding=utf-8 #python version 2.7.4class stack: def __init__(self,list=
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