01 2013 档案
摘要:[python]int(x [,base ]) 将x转换为一个整数 long(x [,base ]) 将x转换为一个长整数 float(x ) 将x转换到一个浮点数 complex(real [,imag ]) 创建一个复数 str(x ) 将对象 x 转换为字符串 repr(x ) 将对象 x 转换为表达式字符串 eval(str ) 用来计算在字符串中的有效Python表达式,并返回一个对象 tuple(s ) 将序列 s 转换为一个元组 list(s ) 将序列 s 转换为一...
阅读全文
摘要:一、Python中的线程使用:Python中使用线程有两种方式:函数或者用类来包装线程对象。1、函数式:调用thread模块中的start_new_thread()函数来产生新线程。如下例:view plaincopy to clipboardprint?importtimeimportthreaddeftimer(no,interval):cnt=0whilecnt<10:print'Thread:(%d)Time:%s\n'%(no,time.ctime())time.sleep(interval)cnt+=1thread.exit_thread()deftest()
阅读全文
摘要:找了蛮多,这篇文章最简单实用1.使用minidom创建XML文件# -*- coding: cp936 -*-"""使用minidom生成XML1.创建Element,createElement2.添加子节点,appendChild3.创建Text,createTextNode4.创建属性,createAttribute"""from xml.dom import minidom,Node# 创建Documentdoc = minidom.Document()# 创建book节点book = doc.createElement(&qu
阅读全文
摘要:python资源下载http://www.lfd.uci.edu/~gohlke/pythonlibs/
阅读全文
摘要:以 Python Imaging Library 進行影像資料處理 author:Yung-Yu Chen (yungyuc) http://blog.seety.org/everydaywork/ <yyc@seety.org>copyright:Copyright 2006, all rights reserved目錄1影像與圖形資料的處理1.1PIL 能為你作的事2轉換圖檔格式3改變影像與製作縮圖4修改圖形內容5用 PIL 製作新影像6結語1影像與圖形資料的處理上一回我們談過了圖形介面程式的撰寫,這一次我們要討論圖形 (影像) 本身的處理,而討論的內容將會集中在 Python
阅读全文
摘要:import osp=os.path.dirname('C:\\win\\yes\\text.txt')print pprint os.path.split(p+"\\")#目录与文件分离print os.path.split(p)print os.path.dirname(p)#the first half of the pair returned by split(path).print os.path.basename(p)#the second half of the pair returned by split(path).print os.pat
阅读全文
摘要:#include "network.h"#include <iostream>#include <string>#include <vector>#include "pcap.h"#include <ntddndis.h>#include "packet32.h"using namespace std;struct packet_t{ ethhdr eth; arphdr arp; u_char pad[18];};int main(int argc, char **argv){ pca
阅读全文