Use python to read and write excel (xlrd, xlwt)

Get a worksheet table = data.sheets()[0] table = data.sheet_by_index(0) table = data.sheet_by_name(u)Get the value of the whole row and the whole column (returned array)Obtain the number of rows and columns6. Get CellsWhen I used it

Python + Django + SAE series tutorial 11 ----- request/pose/get/Form

Form request, post, get First, let's take a look at the Request object, which contains some useful information. It is no stranger to anyone who has learned B/S development, let's take a look at how Django is implemented: Attribute/Method

Using Dynamic variable names in Python

If you want to write a program, set x1 to 1 and x2 to 2 until x100 is 100, what would you do? In a static language such as C, the variable name identifier is actually translated into a memory address by the compiler. Therefore, you cannot set the

Chapter 14 of python, Network Programming

I. socket module There are two types of sockets: Server, client, Create a socket and wait for the connection Server: import sockets = socket.socket()port = 1234host = socket.gethostname()print hosts.bind((host,port))s.listen(5)while True:

Run Linux commands in python

Example 1: Wrap the ls command in python #! /Usr/bin/env python # python wapper for the ls commandimport subprocesssubprocess. call (["ls", "-l"]) in Linux, run this command [root @ pydb python] # python ls. pytotal 8-rwxrwxrwx 1 root 415 Mar 18. py-

Python uses a memory zipfile object to package files in the memory. Example

Copy codeThe Code is as follows:Import zipfileImport StringIO Class InMemoryZip (object ):Def _ init _ (self ):# Create the in-memory file-like objectSelf. in_memory_zip = StringIO. StringIO () Def append (self, filename_in_zip, file_contents

Python Data Structure-Example of Binary Tree statistics and conversion

1. Obtain the depth of a binary treeIs the last level of the Binary Tree, such: Implementation Code:Copy codeThe Code is as follows:Def getheight (self ):'''Retrieve Binary Tree extension '''Return self. _ get_tree_height (self. root)Def _

Install Django on Mac

To use a backend service written in Python, you need to use Django. Refer to the Django installation documentation. The configuration process is as follows: 1. Download pip, a tool used to install and manage Python packages "; 2. After the

Python3.2 official document tutorial --- formatting output

There are many ways to output a program. data can be printed or written to a file in the form that people can understand for future use. This chapter discusses these issues.5.1 format the output Currently, we have come into use two output value

Python multithreading is so simple (continued)

I have talked about a multi-thread blog before, and I feel that I am not doing anything about it. In fact, multithreading is very interesting. Because we are using multiple processes and threads all the time while using computers. We can continue

Python web image capture example (python crawler)

Copy codeThe Code is as follows:#-*-Encoding: UTF-8 -*-'''Created on 2014-4-24 @ Author: Leon Wong''' Import urllib2Import urllibImport reImport timeImport OSImport uuid # Obtain the url of the second-level pageDef findUrl2 (html ):Re1 = r 'HTTP: //

Python BASICS (4) -- strings

All standard sequence operations apply to strings, but strings are immutable. Character % is used for string formatting: Put a string on the left side of %, and put the value to be formatted on the right side. You can use one value or the tuples or

Example of python monitoring network card Traffic and drawing using graphite

Copy codeThe Code is as follows:#! /Usr/bin/env pythonImport sys, timeFrom socket import socketDef read_interface (in_file ):With file (in_file) as f:Return f. readlines () [2:]Def set_interface (inter_msg ):Dic = {}For I in xrange (len (inter_msg ))

Use Python to perform sqlite3 quick and secure data insertion (Anti-injection ).

Table is created using the following statement:Copy codeThe Code is as follows: create table userinfo (name text, email text) Insert data faster Here we use time. clock () for timing and look at the speed of the following three methods.Copy codeThe

Getting started with Numpy in Python

1. What is Numpy? Numpy is a Python scientific computing library that provides matrix computing functions. It is generally used with Scipy and matplotlib. In fact, list already provides a representation similar to a matrix, but numpy provides more

Example of using python to implement forward and reverse DNS queries

1. DNS query process: Take www.baidu.com as an example. (1) The computer sends a request for www.baidu.com resolution to the Local Domain Name Server(2) After receiving the request, the Local Domain Name Server first queries the local cache. If the

Implementation of simhash Algorithm in python

In simple terms, the Simhash algorithm is to quickly search for a simhash set with a difference of less than k digits from a massive amount of text. Here, each text can be represented by a simhash value, A simhash has 64bit, similar texts, and 64bit,

Example of processing rounded and circular images using python

As follows: Figure 1 (the Avatar is cropped in a circular shape, and the others are transparent) Figure 2 (add an ellipse to the four corners of the image) I have never handled it before. It is a little laborious to handle it. Modules used:Copy

Python yield summary and Examples

A function with yield is a generator, which is different from a common function. Generating a generator looks like a function call, but does not execute any function code until it calls next () (next () is automatically called in the for loop to

Python time module (common function instances, very good)

Before you begin, you must first describe these points: 1. in Python, there are usually nine elements in the format of time: 1) timestamp 2) formatted time string 3) tuples (struct_time. Since the time module of Python mainly calls the C library,

Total Pages: 4013 1 .... 3395 3396 3397 3398 3399 .... 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.