[pyyhon] 静态方法和类成员方法 Python的静态方法和类成员方法Python的静态方法和类成员方法都可以被类或实例访问,两者概念不容易理清,但还是有区别的:1)静态方法无需传入self参数,类成员方法需传入代表本类的cls参数;2)从第1条,静态方法是无法访问实例变量的,而类成员方法也同样无法访问实例变量,但可以访问类变量;3)静态方法有点像函数工具库的作用,而类成员方法则更接近类...
[python] Get line number python may definetheir ownfuncin scriptto mimic __LINE__ in C language so as to grab the line make easier, it should be something like this:"""This provides a lineno() function to make i...
[BATCH] An example of re-booting cycling with traces tracking down An overview of reboot cycling script.A top directory called rebooter designed by userA sub-directory call Reboot1. Reboot_run.bat =>this is a startup script used for full script cop...
[BATCH] schtasks C:\Users\Administrator>schtasks /Create /?SCHTASKS /Create [/S system [/U username [/P [password]]]] [/RU username [/RP password]] /SC schedule [/MO modifier] [/D day] [/M months] [/I ...
[BATCH] Basic BAT 转载 http://blog.csdn.net/mcsrainbow/article/details/2025729转载于:https://www.cnblogs.com/yuzi/p/3517220.html
[python] Python yield 使用浅析 转载http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/【】转载于:https://www.cnblogs.com/yuzi/p/3509707.html
[python] StriingIO module StringIO is usually used for buffer of string. which can have stdin,stdout,stderr redirected to a buffer.this moudle contains all of below methods.f=StringIO()#readyforwritingf=S...
[python] raise statement 1. raise an exception defined by user. 1 class MyException(Exception): 2 ''' An exception defined by user,inherit from Top Exception''' 3 def __init__(self,length,atleastlength):...
[python] os.walk() & os.path.walk() os.walk(top) =>this method is acceptable with a valid path, and return a tuple,which consists of 3 elements being path string of path name,list of dictionary name, and list of file name everyt...
[python] Parse arguments sys.argv1 import sys2 def parse_args():3 for arg in sys.argv[1:]:4 print arggetopt 1 import sys 2 import getopt 3 def test_getopt(): 4 """ 5 'Usage:t...
[python] inherit An simple example presentation 1 #inherit 2 class Parent: 3 '''reprensent parent''' 4 def __init__(self, name, age): 5 self.name = name 6 self.age = age 7 ...
[python] with statement An example presentation 1 import sys 2 class test: 3 def __enter__(self): 4 print("enter") 5 return 1 # return value is assigned to 't' 6 def __exit__(...
[Python] pickle module python对象与文件之间的序列化和反序列化:pickle.dump()pickle.load()pickle.dump(obj, file, [,protocol])protocol=>0 ASCII,1 older protocol,2 new protocol, it is necessary to open with'rb,wb'if protocal>...
[python] subprocess module 1.subprocess.PopenPopen will enable a child-process and parent process in parallel.subprocess.Popen(['type','test.py'],shell=True)subprocess.Popen('tpye test.py',shell=True)1 def Te...
[BATCH] Parse TXT file Test conditionsTwo files (devinfo.txt, test.bat ) are need to present in the same folder, something look like this c:\test\devinfo.txt'contents, pls take a note that this file is generated...
[python] *args **kwargs Source code is as below: 1 def func(*args,**kwargs): 2 print 'args=',args 3 print 'kwargs=',kwargs 4 print '_'*30 5 6 def main(): 7 func(1,2,3,4) 8 func(a=1...
[python] Time convertion 1)>>> import time>>> ISOTIMEFORMAT='%Y-%m-%d %X'>>> print time.strftime(ISOTIMEFORMAT,time.localtime())2013-12-28 14:00:17>>> import datetime>>> p...