Learn TDD and Python

TDD uses the implementation of xunit as an example. It also makes me feel the charm of Dynamic Language (optimistic language ). Code Come: Class Testcase: Def   _ Init __ (Self, name ):Self. Name = Name Def Setup ( Pass ):

Serialization in Python -- marshal and cpickle

# ! /Usr/bin/Python # Coding = UTF-8 Import OS Import Marshal, cpickle """ Marshal can only serialize limited typesCpickle can serialize custom types. """ Class Foo: Def _ Init __ (Self, name ):Self. Name = Name Def _ STR __ (Self ):

Python remote logon code

In python, there is a telnetlib, which is used to create a physical Telnet connection to the host, and then send commands to the host (just as input on the keyboard) and receive data from the connection. With this function, we can change all the

Python httplib and smtplib usage

Example 1: Use httplib to access a URL and obtain the returned content: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> Import HttplibConn = Httplib. httpconnection ( " Www.cnblogs.com

Python web page capture program

This program is used to capture text from the web page, that is, extract the text of the tomb stealing notes. It is easy to write, and you can't laugh at it. ''' Obtain the address of the specific content of each set from the website where the tomb

Python! Surprising python

Today, I saw the Test-Driven Development in Python article, which mentioned that the unittest Module was provided in version 2.1, and pyUnit is similar to xUnit tools such as JUnit, it's amazing. When I looked at the source code of the python

Python core programming learning diary file and Input and Output

File and input/output Object Generic file objects: objects with file-type interfaces, such as files, Web pages, and communications. A file is a continuous byte sequence. Byte streams are often used for data transmission. Open ():

Example of getting time using python

Copy codeThe Code is as follows: import time Print time. time () Print time. localtime (time. time ()) Print time. strftime ('% Y-% m-% d', time. localtime ()) Print time. strftime ('% y-% m-% d', time. localtime ()) Print time. strftime ('% Y-% m-%

Introduction to Condition Selection and circular statement usage in Python

Like C and Java, Condition Selection and loop statements exist in Python. Their style is similar to that in C and java, but there are still some differences in writing and usage. Let's take a look at it today. I. Condition Selection statement

To update Python in centos

After CentOS5.9 (Final) is installed, run # Python and # python-V. You can see that the version number is 2.4.3, which is very old. What you wrote earlier is running on python3.X. 3. X and 2. X has many differences. If you are interested, refer to

Python-based Chinese character conversion GBK code implementation code

, "Wide" is encoded as % B9 % E3. % B9 is called a section encoding, and % E3 is a character encoding (second encoding ). Ideas:Collect Chinese Character http://ff.163.com/newflyff/gbk-list/ from GBK encoding pageFrom a practical point of view,

Detailed analysis of python Random Number Generation Code

The following articles mainly introduce the python Random Number Generation Code to introduce the specific application of Python Random Number Generation in the actual operation process. If you are interested in the relevant content, you can click

Python Step 1 hello world

First download the latest version of python. Www.python.org. The current version is 3.1. Next, install python in windows, which is the same as other applications. In windows, you can use command line or IDLE to develop python. First, we will

Python open read/Write File implementation script

Document directory 1. open 2. Read files 3. Write files 1. open After opening a file using open, remember to call the close () method of the file object. For example, you can use the try/finally statement to ensure that the file can be

Installation of Python _ python

Python can run almost on any platform, as we are familiar with: Windows/Unix/Linux/Macintosh. Here we will talk about installing python in Windows. My operating system is: Windows 7, 32-bit When installing python, we can install python from both

Curialization of functions in Python

1. Currying) A function has multiple parameters. We hope to fix the values of these parameters. Functools partial (a, B, c): a + B + c = partial (foo, B = 2) foo2 (a = 1, c = 3) It seems that this is similar to providing the default parameter

Python developer _ a self-developed game

First, let's take a look at the running effect of the game: After watching the running status of the game, you may have some knowledge about the game: Code Section: language_option = enter_str = en_game_start_str =

Use of the python Automatic Installation Tool setuptools (easy_install)

1. Download and install python Installation tool, http://pypi.python.org/pypi/setuptools . (Or run python ez_setup.py in cmd to automatically install setuptools ).3. When installing the python module, first enter"Command. The following content is

Python development _ html_html Processing

The module provides only one method: html. escape (s, quote = True) This method is mainly used to convert special characters (&, , ", ', etc.) in html files to HTML-safe characters. Below is a demo I made: : Python 3.3.2 (v3.3.2:d047928ae3f6, May 16

Python calls the dynamic link library (DLL) of VC ++)

1. First, the export function of VC ++ DLL 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)#

Total Pages: 4013 1 .... 2251 2252 2253 2254 2255 .... 4013 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.