2013年1月3日

python的专用类方法

摘要: #!/usr/bin/pythonimport mathclass Vector: def __init__(self, a, b): self.a = a self.b = b def __str__(self): return 'Vector (%d, %d)' % (self.a, self.b) def __add__(self,other): return Vector(self.a + other.a, self.b + other.b) def __abs__(self): return math.... 阅读全文

posted @ 2013-01-03 11:23 mymemory 阅读(120) 评论(0) 推荐(0)

python更改文件夹下文件名字

摘要: '''Created on 2013-1-2@author: buptlishantao'''#!/usr/bin/pythonimport reimport osimport timedef change_name(path): global i if not os.path.isdir(path) and not os.path.isfile(path): return False if os.path.isfile(path): file_path = os.path.split(path) #split the path ... 阅读全文

posted @ 2013-01-03 11:05 mymemory 阅读(377) 评论(0) 推荐(0)

导航