对象的概念同其他语言的对象相同一个基本的类#!/usr/bin/pythonclass person: def hi(self,name): print 'Hello,%s'%namep1= person()p1.hi('lk')[root@likun p...
分类:
其他好文 时间:
2014-10-07 20:24:23
阅读次数:
223
1. Arbitrary multi parameters funcssum(1,2,3,4,5) = sum(1 to 5: _*)the equal '=' can be ignored if there is none return val1 def sum(args: Int*) = {2 ...
分类:
其他好文 时间:
2014-10-07 00:25:22
阅读次数:
285
对于面向对象总是要提到,万物皆对象。好似博大精深的感觉。接下来一起看看python的面向对象的例子创建一个对象 class Person: type = 'person' def __init__(self, name = 'Noname'): self.name = name def h...
分类:
编程语言 时间:
2014-10-06 20:17:00
阅读次数:
343
端口扫描器原理很简单,无非就是操作socket,能connect就认定这个端口开放着。
import socket
def scan(port):
s = socket.socket()
if s.connect_ex(('localhost', port)) == 0:
print port, 'open'
s.close()
if __name__ =...
分类:
其他好文 时间:
2014-10-06 17:17:30
阅读次数:
234
任务:在进行长时间操作时,向用户显示一个"进度指示条"。解决方案:#coding=utf-8import sysclass progressbar(object): def __init__(self,finalcount,block_char='.'): self.finalc...
分类:
其他好文 时间:
2014-10-06 01:03:19
阅读次数:
216
Write a function to find the longest common prefix string amongst an array of strings.class Solution: # @return a string #最长公共前缀 def longestC...
分类:
编程语言 时间:
2014-10-05 20:35:58
阅读次数:
202
#微观剖析'''当找到速度很慢函数时,有时还需要做到测试某个部分函数剖析工作,这需要通过手动对一部分代码速度测试完成'''"""importtempfile,os,pstats,cProfiledefp1(column='time',list1=5):def_p1(function):def__p1...
分类:
编程语言 时间:
2014-10-05 18:48:48
阅读次数:
195
一个DumpDex的IDA插件
源码
import idaapi
import struct
def dumpdex(start, len, target):
rawdex = idaapi.dbg_read_memory(start, len)
fd = open(target, 'wb')
fd.write(rawdex)
fd.close()
def getdexlen...
分类:
其他好文 时间:
2014-10-05 16:41:58
阅读次数:
285
1 #-*-coding:utf-8-*- 2 def bubble(array): 3 flag = True; 4 for i in range(len(array)-1,0,-1):#从后往前比较 5 #print 'i = ',i 6 if...
分类:
编程语言 时间:
2014-10-04 17:50:26
阅读次数:
443
#-*-coding:cp936-*-fromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*classInlineEditor(QWidget):_MUTE='MUTE'def__init__(self,parent):QWidget.__init__(self,...
分类:
其他好文 时间:
2014-10-04 17:17:26
阅读次数:
184