上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 36 下一页
[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 转换为一... Read More
posted @ 2013-01-24 15:21 godjob Views(748) Comments(0) Diggs(0) Edit
一、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() Read More
posted @ 2013-01-15 17:46 godjob Views(290) Comments(0) Diggs(0) Edit
找了蛮多,这篇文章最简单实用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 Read More
posted @ 2013-01-15 16:10 godjob Views(796) Comments(0) Diggs(0) Edit
python资源下载http://www.lfd.uci.edu/~gohlke/pythonlibs/ Read More
posted @ 2013-01-14 15:53 godjob Views(656) Comments(0) Diggs(0) Edit
以 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 Read More
posted @ 2013-01-14 15:38 godjob Views(301) Comments(0) Diggs(0) Edit
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 Read More
posted @ 2013-01-06 10:12 godjob Views(268) Comments(0) Diggs(0) Edit
#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 Read More
posted @ 2013-01-01 16:42 godjob Views(584) Comments(0) Diggs(0) Edit
1.获取设备列表:#include "pcap.h"main(){ pcap_if_t *alldevs; pcap_if_t *d; int i=0; char errbuf[PCAP_ERRBUF_SIZE]; /* Retrieve the device list from the local machine */ if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &alldevs, errbuf) == -1) { fpri... Read More
posted @ 2012-12-30 11:56 godjob Views(407) Comments(0) Diggs(0) Edit
以太网ethernet代码/* This is an Ethernet frame header. */struct ethhdr { unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ unsigned short h_proto; /* packet type ID field */};ARP头部/* ARP protocol opcodes. */#define ARPOP_REQUEST 1 /* ... Read More
posted @ 2012-12-29 23:41 godjob Views(555) Comments(0) Diggs(0) Edit
[本文英文原文链接:Improving Your Python Productivity / 外刊IT评论]我已经使用Python编程有多年了,即使今天我仍然惊奇于这种语言所能让代码表现出的整洁和对 DRY编程原则的适用。这些年来的经历让我学到了很多的小技巧和知识,大多数是通过阅读很流行的开源软件,如 Django, Flask, Requests中获得的。下面我挑选出的这几个技巧常常会被人们忽略,但它们在日常编程中能真正的给我们带来不少帮助。1. 字典推导(Dictionary comprehensions)和集合推导(Set comprehensions)大多数的Python程序员都知道且 Read More
posted @ 2012-12-26 19:33 godjob Views(188) Comments(0) Diggs(0) Edit
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 36 下一页