01 2019 档案

摘要:# 定义 class T: a = 123 #类属性 def func(self): #类方法 pass @classmethod def classfunc(cls): pass @staticmethod def staticfunc(): ... 阅读全文
posted @ 2019-01-22 15:49 我是外婆 阅读(300) 评论(0) 推荐(0)
摘要:import logging from logging import FileHandler, Formatter import os.path as fpath from datetime import datetime logfile = fpath.join(fpath.dirname(fpath.abspath(__file__)),datetime.now().strftime('%Y... 阅读全文
posted @ 2019-01-22 14:29 我是外婆 阅读(569) 评论(0) 推荐(0)
摘要:import heapq #用heapq 支持自定义对象 #heapq可以用默认list类型来创建堆结构, #用[]来创建堆结构不建议给初始值,如果非得给的话建议先调用heapq.heapify进行转化 import random a = [] for i in range(10): heapq.heappush(a, random.randint(1, 10)) ... 阅读全文
posted @ 2019-01-21 16:41 我是外婆 阅读(848) 评论(0) 推荐(0)
摘要:##python 中特殊方法简写方式 class Test: __call__ = lambda *args: args[1] * 2 #这里需要注意lambda的参数 会默认将实例self 加进去 __str__ = lambda self: 'that`s useful...%s' % self.__class__.__name__ t = Test() prin... 阅读全文
posted @ 2019-01-20 01:36 我是外婆 阅读(1022) 评论(0) 推荐(0)
摘要:import sys default_path = r'C:\Users\lon\Desktop' #自定义路径 sys.path.append(default_path) #将自定义路径加到sys模块path路径中 print(sys.path) from test1 import Demo d = Demo() print(d.Hi()) 阅读全文
posted @ 2019-01-19 15:46 我是外婆 阅读(322) 评论(0) 推荐(0)
摘要:class Program { public static void Main(string[] args) { string[] urls = new string[]{ "http://wwww.baidu.coms", "http://w... 阅读全文
posted @ 2019-01-02 11:31 我是外婆 阅读(449) 评论(0) 推荐(0)