yipeiwu_com6年前
核心代码: 复制代码 代码如下:#!/usr/bin/python#Filename:friendbook.pyimport cPickle as pimport sysimport t...
yipeiwu_com6年前
1.引入库需要用到3个类,ElementTree,Element以及建立子类的包装类SubElement from xml.etree.ElementTree import Elemen...
yipeiwu_com6年前
文件操作示例 复制代码 代码如下:#输入文件f = open(r'D:\Python27\pro\123.bak') #输出文件fw = open(r'D:\Python27\pro\1...
yipeiwu_com6年前
这是具有利用不同协议获取URLs的能力,他同样提供了一个比较复杂的接口来处理一般情况,例如:基础验证,cookies,代理和其他。它们通过handlers和openers的对象提供。ur...
yipeiwu_com6年前
安装paramiko后,看下面例子: 复制代码 代码如下:import paramiko #设置ssh连接的远程主机地址和端口t=paramiko.Transport((ip,port)...
yipeiwu_com6年前
可以使用Python的email模块来实现带有附件的邮件的发送。 SMTP (Simple Mail Transfer Protocol)邮件传送代理 (Mail Transfer Ag...
yipeiwu_com6年前
复制代码 代码如下:# -*- coding: utf-8 -*- #mysqldb import...
yipeiwu_com6年前
Proxy 的设置 urllib2 默认会使用环境变量 http_proxy 来设置 HTTP Proxy。如果想在程序中明确控制 Proxy 而不受环境变量的影响,可以使用下面的方式...
yipeiwu_com6年前
准备工作 开发环境:python2.6,reportlab 准备中文字体文件:simsun.ttc 代码: 复制代码 代码如下:#!/usr/bin/env python2.6#codi...
yipeiwu_com6年前
前提:安装libxml2 libxstl 官方网站:http://xmlsoft.org/XSLT/index.html 安装包下载:http://xmlsoft.org/sources...