- 博客(18)
- 收藏
- 关注
转载 [pyyhon] 静态方法和类成员方法
Python的静态方法和类成员方法Python的静态方法和类成员方法都可以被类或实例访问,两者概念不容易理清,但还是有区别的:1)静态方法无需传入self参数,类成员方法需传入代表本类的cls参数;2)从第1条,静态方法是无法访问实例变量的,而类成员方法也同样无法访问实例变量,但可以访问类变量;3)静态方法有点像函数工具库的作用,而类成员方法则更接近类...
2019-09-24 02:03:06 128
转载 [python] metaclass
转载 http://blog.jobbole.com/21351/转载于:https://www.cnblogs.com/yuzi/p/3517866.html
2019-09-24 02:03:04 80
转载 [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...
2019-09-24 02:03:02 348
转载 [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...
2019-09-24 02:03:02 149
转载 [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 ...
2019-09-24 02:03:00 112
转载 [BATCH] Basic BAT
转载 http://blog.csdn.net/mcsrainbow/article/details/2025729转载于:https://www.cnblogs.com/yuzi/p/3517220.html
2019-09-24 02:02:59 122
转载 [python] Python yield 使用浅析
转载http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/【】转载于:https://www.cnblogs.com/yuzi/p/3509707.html
2019-09-24 02:02:57 52
转载 [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...
2019-09-24 02:02:56 90
转载 [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):...
2019-09-24 02:02:28 97
转载 [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...
2019-09-24 02:02:26 213
转载 [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...
2019-09-24 02:02:24 555
转载 [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 ...
2019-09-24 02:02:09 348
转载 [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__(...
2019-09-24 02:02:07 97
转载 [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>...
2019-09-24 02:02:05 132
转载 [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...
2019-09-24 02:02:04 95
转载 [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...
2019-09-24 02:02:02 796
转载 [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...
2019-09-24 02:01:56 120
转载 [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...
2019-09-24 02:01:54 168
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人