08 2016 档案

linux内核定时器
摘要:今天参考linux驱动开发详解,照抄了一份second的程序,用到了timer。总的来说,timer的用法还是很简单的。主要需要定义一个timer_list变量timer、先初始化timerinit_timer(&timer);then 对timer的相关参数赋值:timer.function = 阅读全文

posted @ 2016-08-18 15:06 与非朋仔 阅读(1141) 评论(0) 推荐(0) 编辑

python类
摘要:def Main(): class A: pass a=A() a.x=1 print a.x if __name__=="__main__": Main() #-*-coding:utf-8-*- import sys def Main(): class A: def __init__(self): ... 阅读全文

posted @ 2016-08-06 18:06 与非朋仔 阅读(144) 评论(0) 推荐(0) 编辑

python获取
摘要:def anc():pass print anc.__name__ def timeit(func): def run(*argv): print "this function name is", func.__name__ if argv: ret = func(*argv) else: ... 阅读全文

posted @ 2016-08-06 16:43 与非朋仔 阅读(161) 评论(0) 推荐(0) 编辑

如何获得调用函数的函数名
摘要:def get_cur_info(): """Return the frame object for the caller's stack frame.""" try: raise Exception except: f = sys.exc_info()[2].tb_frame.f_back ret 阅读全文

posted @ 2016-08-06 15:38 与非朋仔 编辑

python logging模块
摘要:#!/usr/bin/python # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- Function: 【整理】Python中的logging模块的使用(可以实现同时输出信息到cmd终端窗口和log文件(txt)中) http:/... 阅读全文

posted @ 2016-08-05 16:46 与非朋仔 编辑

python相对路径
摘要:print "os.path.dirname(os.path.abspath('.'))",os.path.dirname(os.path.abspath('.')) print "os.path.dirname(os.path.dirname(os.path.abspath('.')))",os.path.dirname(os.path.dirname(os.path.abspath('.')... 阅读全文

posted @ 2016-08-04 16:29 与非朋仔 阅读(107) 评论(0) 推荐(0) 编辑

python生成器
摘要:def func_list_empty(l = []): l.append(2) return l def func_list_none(l = None): if l == None: l = [] l.append(2) return l def test_list_empty(l = []): func_l... 阅读全文

posted @ 2016-08-03 15:59 与非朋仔 阅读(161) 评论(0) 推荐(0) 编辑

IP子网掩码格式转换
摘要:def exchange_maskint(mask_int): bin_arr = ['0' for i in range(32)] for i in range(mask_int): bin_arr[i] = '1' tmpmask = [''.join(bin_arr[i * 8:i * 8 + 阅读全文

posted @ 2016-08-02 14:30 与非朋仔 阅读(803) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示