自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 python ElementTree 基本读操作示例

python ElementTree 基本读操作示例 演示用XML文件:test.xml view plaincopy to clipboardprint? hzj man kiki female hzj man kiki fema...

2011-01-27 13:44:26 185

原创 Python Socket写的简单Server

文章来自:[url]http://hi.baidu.com/yobin/blog/item/572e554e51648f0fb3de05d9.html[/url] 一、python server(代码是蓝色部分,注释为黑色字体) [color=blue]#!/usr/bin/python import socket import re import os[/color] #...

2011-01-25 08:55:40 157

原创 python语言解析xml文件的常用的有两种方式

文章来自:http://jordy.easymorse.com/?p=442。 python语言解析xml文件的常用的有两种方式: * 通过MiniDom库解析xml文件 * 通过ElementTree库解析xml文件 MiniDom方式解析xml xml文件以data.xml为例,具体操作如下: data.xml: 保存用户的...

2011-01-25 08:48:07 176

原创 python easy_install 简单应用

Python中的easy_install工具很爽,它的作用类似于Php中的pear,或者Ruby中的gem,或者Perl中的cpan。 如果想使用easy_install工具,可能需要先安装setuptools,不过更酷的方法是使用ez_setup.py脚本: wget -q http://peak.telecommunity.com/dist/ez_setup.py python ...

2010-11-14 12:35:36 165

原创 python模块commands的简单使用

看一下三个函数: 1). commands.getstatusoutput(cmd) 用os.popen()执行命令cmd, 然后返回两个元素的元组(status, result). cmd执行的方式是{ cmd ; } 2>&1, 这样返回结果里面就会包含标准输出和标准错误. 2). commands.getoutput(cmd) 只返回执行的结果, 忽略返回值. ...

2010-11-03 09:17:20 415

原创 Linux之VI命令详解(转载)

功能最强在的编辑器——vi vi是所有UNIX系统都会提供的屏幕编辑器,它提供了一个视窗设备,通过它可以编辑文件。当然,对UNIX系统略有所知的人, 或多或少都觉得vi超级难用,但vi是最基本的编辑器,所以希望读者能好好把它学起来,以后在UNIX世界里必将畅行无阻、 游刃有余,因为其他几种文本处理器并非UNIX标准配备。说不定别人的Linux机器没安装joe或pico,如果您不会vi,那您可...

2010-11-02 10:47:14 119

原创 python decorator的应用和书写

在我以前介绍 Python 2.4 特性的Blog中已经介绍过了decorator了,不过,那时是照猫画虎,现在再仔细描述一下它的使用。 关于decorator的详细介绍在 Python 2.4中的What’s new中已经有介绍,大家可以看一下。 如何调用decorator 基本上调用decorator有两种形式 第一种: @A def f (): ...

2010-10-29 08:41:31 87

原创 python redis的安装与使用

#1、安装 好吧,我承认我只会最简单的安装 sudo apt-get install redis-server python 支持包: (其实就一个文件,搞过来就能用) sudo apt-get install python-redis #2、配置 配置一下吧,默认配置文件在: “/etc/redis/redis.conf” 绑定ip: “bind 127.0.0.1″ -...

2010-10-25 08:45:57 204

原创 python中isinstance用法 (判断数据类型)

isinstance( object, classinfo) Return true if the object argument is an instance of the classinfo argument, or of a (direct or indirect) subclass thereof. Also return true if classinfo is a type...

2010-10-21 16:52:07 1114

原创 Python UUID模块 (uuid4() creates a random UUID)

UUID objects (universally unique identifiers) according to RFC 4122. This module provides immutable UUID objects (class UUID) and the functions uuid1(), uuid3(), uuid4(), uuid5() for generating v...

2010-10-21 15:00:08 298

原创 Python hashlib模块 (主要记录md5加密)

python提供了一个进行hash加密的模块:hashlib 下面主要记录下其中的md5加密方式 >>> import hashlib >>> m = hashlib.md5() >>> m.update("Nobody inspects") >>> m.update(" the spammish repetition") >>&

2010-10-21 14:51:38 134

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除