python笔记 - day5

参考:

http://www.cnblogs.com/wupeiqi/articles/5484747.html

http://www.cnblogs.com/alex3714/articles/5161349.html

http://www.cnblogs.com/wupeiqi/articles/5501365.html

大纲:

双层装饰器

python字符串格式化

python生成器

python迭代器

python模块介绍

python序列化之json

python序列化之pickle

python时间处理之time模块

python日志处理之logging模块

模块:

logging
time/datetime
json/pickle
requests

双层装饰器:

方法一,不使用装饰器:

  1. #!/usr/bin/python env
  2. #_*_coding:utf-8 _*_
  3.  
  4. USER_INFO = {}
  5.  
  6. def check_login(func):
  7. def inner(*args,**kwargs):
  8. if USER_INFO.get('is_login',None):
  9. ret = func(*args,**kwargs)
  10. return ret
  11. else:
  12. print("请登录")
  13. return inner
  14.  
  15. def check_admin(func):
  16. def inner(*args,**kwargs):
  17. if USER_INFO.get('is_login',None):
  18. if USER_INFO.get('user_type') == 2:
  19. ret = func(*args,**kwargs)
  20. return ret
  21. else:
  22. print("无权限查看.")
  23. else:
  24. print("请登录")
  25. return inner
  26.  
  27. @check_admin
  28. def index():
  29. print("Index,admin")
  30.  
  31. @check_login
  32. def home():
  33. print("home,command")
  34.  
  35. def login():
  36. user = input("请输入用户名:")
  37. if user == 'admin':
  38. USER_INFO['is_login'] = True
  39. USER_INFO['user_type'] = 2
  40. else:
  41. USER_INFO['is_login'] = True
  42. USER_INFO['user_type'] = 1
  43.  
  44. def main():
  45. while True:
  46. inp = input("1.login 2.查看信息 3.用户管理")
  47. if inp == '1':
  48. login()
  49. elif inp == '2':
  50. home()
  51. elif inp == '3':
  52. index()
  53. main()

方法二,使用双层装饰器:

  1. #!/usr/bin/python env
  2. #_*_coding:utf-8 _*_
  3.  
  4. USER_INFO = {}
  5.  
  6. def check_login(func):
  7. def inner(*args,**kwargs):
  8. if USER_INFO.get('is_login',None):
  9. ret = func(*args,**kwargs)
  10. return ret
  11. else:
  12. print("请登录")
  13. return inner
  14.  
  15. def check_admin(func):
  16. def inner(*args,**kwargs):
  17. if USER_INFO.get('user_type') == 2:
  18. ret = func(*args,**kwargs)
  19. return ret
  20. else:
  21. print("无权限查看.")
  22. return inner
  23.  
  24. @check_login
  25. @check_admin
  26. def index():
  27. print("Index,admin")
  28.  
  29. @check_login
  30. def home():
  31. print("home,command")
  32.  
  33. def login():
  34. user = input("请输入用户名:")
  35. if user == 'admin':
  36. USER_INFO['is_login'] = True
  37. USER_INFO['user_type'] = 2
  38. else:
  39. USER_INFO['is_login'] = True
  40. USER_INFO['user_type'] = 1
  41.  
  42. def main():
  43. while True:
  44. inp = input("1.login 2.查看信息 3.用户管理")
  45. if inp == '1':
  46. login()
  47. elif inp == '2':
  48. home()
  49. elif inp == '3':
  50. index()
  51. main()
  52.  
  53. #双层装饰器,解释,从下往上解释,执行,从上往下执行;

字符串格式化(%,format)

  1. % 号方式,字符串格式化:
  2.  
  3. tp1 = "i am %s " % 'alex'
  4. print(tp1)
  5. 结果:i am alex
  6.  
  7. tp1 = "i am %s age %d"%('alex',18)
  8. print(tp1)
  9. 结果:i am alex age 18
  10.  
  11. 【传入的是字典格式】
  12. tp1 = "i am %(name)s age %(age)d" %{"name":"alex","age":18}
  13. print(tp1)
  14. 结果:i am alex age 18
  15.  
  16. 【取小数点后两位】
  17. tp1 = "percent %.2f"%88.234567
  18. print(tp1)
  19. 结果:percent 88.23
  20.  
  21. 【以字典形式传入,取小数点后两位】
  22. tp1 = "i am %(pp).2f"%{"pp":123.234345,}
  23. print(tp1)
  24. 结果:123.23
  25.  
  26. 【以字典形式传入,取小数点后两位,并加上 % 号】
  27. tpl = "i am %(pp).2f %% "%{"pp": 123.425556, }
  28. print(tpl)
  29. 结果:i am 123.43 %
  30.  
  31. format,字符串格式化:
  32.  
  33. 【顺序传入参数】
  34. t1 = "i am {},age{},{}".format("seven",18,'alex')
  35. print(t1)
  36. 结果:i am seven,age18,alex
  37.  
  38. 【*[] , 以列表的形式传入参数】
  39. t1 = "i am {},age {},{}".format(*['seven',18,'alex'])
  40. print(t1)
  41. 结果:i am seven,age 18,alex
  42.  
  43. 【根据数字定位,字符串输出】
  44. t2 = "i am {0},age {1},really{0}".format("seven",19)
  45. print(t2)
  46. 结果:i am seven,age 19,reallyseven
  47.  
  48. 【*[] ,根据数字定位,字符串输出,传入的是个列表】
  49. t2 = "i am {0}, age{1}, really{0}".format(*["seven",18])
  50. print(t2)
  51. 结果:i am seven, age18, reallyseven
  52.  
  53. 【根据指定的字符串来格式化输出】
  54. t3 = "i am {name}, age{age},really{name}".format(name="seven",age=18)
  55. print(t3)
  56. 结果:i am seven, age18,reallyseven
  57.  
  58. 【**{},根据指定的字符串来格式化输出,并且是以字典的形式传入】
  59. t3 = "i am {name}, age{age}, really {name}".format(**{"name":"seven","age":18})
  60. print(t3)
  61.  
  62. 【通过列表取值的方式,格式化输出】
  63. t4 = "i am {0[0]}, age{0[1]}, really {0[2]}".format([1,2,3],[11,22,33])
  64. print(t4)
  65. 结果:i am 1, age2, really 3
  66.  
  67. 【根据类型,格式化输出】
  68. t5 = "i am {:s}, age{:d},money {:f} ".format("seveb",18, 888888.1)
  69. print(t5)
  70. 结果:i am seveb, age18,money 888888.100000
  71.  
  72. 【*[],列表形式】
  73. t6 = "i am {:s}, age{:d}".format(*["seven",18])
  74. print(t6)
  75. 结果:i am seven, age18
  76.  
  77. 【指定字符串,格式化输出】
  78. t7 = "i am {name:s},age{age:d}".format(name="seven",age=18)
  79. print(t7)
  80. 结果:i am seven,age18
  81.  
  82. 【**{},传入的字典格式】
  83. t8 = "i am {name:s},age {age:d}".format(**{"name":"seven","age":18})
  84. print(t8)
  85. 结果:i am seven,age 18
  86.  
  87. 2进制,八进制,十进制,16进制,16进制,百分比】
  88. 【下面三个例子,结果一样,只不过传入值得形式不一样】
  89. t9 = "numbers:{:b},{:o},{:d},{:x},{:X},{:%}".format(15, 15, 15, 15, 15, 15.87623, 2)
  90. print(t9)
  91. 结果:numbers:1111,17,15,f,F,1587.623000%
  92.  
  93. t9 = "numbers: {0:b},{0:o},{0:d},{0:x},{0:X},{0:%}".format(15)
  94. print(t9)
  95. 结果:numbers: 1111,17,15,f,F,1500.000000%
  96.  
  97. t99 = "numbers:{num:b},{num:o},{num:d},{num:x},{num:X},{num:%}".format(num=15)
  98. print(t9)
  99. 结果:numbers:1111,17,15,f,F,1500.000000%

python生成器:

  1. 例一:
  2. def func():
  3. print("start")
  4. yield 1
  5. yield 2
  6. yield 3
  7. ret = func()
  8.  
  9. for i in ret:
  10. print(i)
  11. 结果:
  12. start
  13. 1
  14. 2
  15. 3
  16.  
  17. 例二:
  18. def func():
  19. print(11111)
  20. yield 1
  21. print(22222)
  22. yield 2
  23. print(33333)
  24. yield 3
  25. ret = func()
  26. r1 = ret.__next__() #进入函数,找到yield,获取yield后面的数据
  27. print(r1)
  28.  
  29. r2 = ret.__next__()#进入函数,找到yield,获取yield后面的数据
  30. print(r2)
  31.  
  32. r3 = ret.__next__()#进入函数,找到yield,获取yield后面的数据
  33. print(r3)
  34. 结果:
  35. 11111
  36. 1
  37. 22222
  38. 2
  39. 33333
  40. 3
  41.  
  42. 迭代器,生成器,模拟一个range()函数:
  1. def myrange(arg):
    start = 0
    while True:
    if start > arg:
    return
    yield start
    start +=1
    ret = myrange(3)
  2.  
  3. r = ret.__next__()
    print(r)
    r = ret.__next__()
    print(r)
    r = ret.__next__()
    print(r)
    r = ret.__next__()
    print(r)
    结果:
    0
    1
    2
    3
  1. 函数递归:
    def func(n):
    n +=1
    if n >= 4:
    return 'end'
    return func(n)
  2.  
  3. r = func(1)
    print(r)
    结果:end

python模块:

  1. t6.py文件内容:
  2.  
  3. def login():
  4. print("login")
  5.  
  6. def loginout():
  7. print('loginout')
  8.  
  9. t7文件里导入并执行login()模块:
  10. import t6
  11. t6.login()
  12.  
  13. 导入模块的几种方法:
  14. 1improt
  15. 调用:模块名.函数名
  16.  
  17. 2from t6 import login
  18. 调用:可以直接调用 函数名调用
  19.  
  20. 3from t6 import *
  21. 导入t6模块下的所有函数
  22.  
  23. 4from t6 import login as t6_commons
  24. 应用于,在一个py文件中,导入不同模块,有相同函数名冲突时,可以给其中一个模块设置一个别名;
  25.  
  26. 总结:同一级目录下用import导入
  27. 否则用 from 导入;
  1. 打印python执行程序,查找文件路径:
    import sys
  2. for item in sys.path:
  3. print(item)
  4.  
  5. 【把 E 目录,添加到python查找的路径中】
  6. sys.path.append('E:\\')
  7.  
  8. 【安装第三方模块】
  9. pip3 install requests
  10.  
  11. 源码方式安装模块:
  12. 1.把下载的源码包解压了
  13. 2.进入到源码包目录
  14. 3.运行 python setup.py install,如果不依赖其他内容,一下就安装成功了;

json,pickle 序列化:

  1. json.dumps:将python基本数据类型转化成字符串形式】
  2. dic = {"k1":"v1"}
  3. print(dic,type(dic))
  4. 结果:{'k1': 'v1'} <class 'dict'>
  5.  
  6. result=json.dumps(dic)
  7. print(result,type(result))
  8. 结果:{"k1": "v1"} <class 'str'>
  9.  
  10. json.loads:将字符串,转换成python对应格式的数据类型】
  11. s1 = '{"k1":123}' #通过loads,反序列话的时候,里面必须要使用双引号;因为需要跨平台
  12. print(s1,type(s1))
  13. 结果:{"k1":123} <class 'str'>
  14.  
  15. dic = json.loads(s1)
  16. print(dic,type(dic))
  17. 结果:{'k1': 123} <class 'dict'>
  18.  
  1. import requests
    import json
  2.  
  3. response = requests.get('http://wthrcdn.etouch.cn/weather_mini?city=北京')
    #发了一个http请求,把请求的内容返回给response,封装到response对象里面
    response.encoding = 'utf-8'
  4.  
  5. dic = json.loads(response.text) #.text,获取http请求的内容;
    print(dic,type(dic))
  6.  
  7. 结果:
    {'data': {'forecast': [{'fengxiang': '无持续风向', 'type': '多云', 'date': '27日星期三', 'low': '低温 25℃', 'fengli': '微风级', 'high': '高温 34℃'}, {'fengxiang': '无持续风向', 'type': '雷阵雨', 'date': '28日星期四', 'low': '低温 23℃', 'fengli': '微风级', 'high': '高温 33℃'}, {'fengxiang': '无持续风向', 'type': '多云', 'date': '29日星期五', 'low': '低温 24℃', 'fengli': '微风级', 'high': '高温 32℃'}, {'fengxiang': '无持续风向', 'type': '阴', 'date': '30日星期六', 'low': '低温 26℃', 'fengli': '微风级', 'high': '高温 32℃'}, {'fengxiang': '无持续风向', 'type': '晴', 'date': '31日星期天', 'low': '低温 26℃', 'fengli': '微风级', 'high': '高温 34℃'}], 'yesterday': {'type': '晴', 'date': '26日星期二', 'low': '低温 24℃', 'fl': '微风', 'fx': '无持续风向', 'high': '高温 33℃'}, 'aqi': '141', 'wendu': '33', 'ganmao': '各项气象条件适宜,发生感冒机率较低。但请避免长期处于空调房间中,以防感冒。', 'city': '北京'}, 'status': 1000, 'desc': 'OK'} <class 'dict'>
  8.  
  9. json.dump,先序列化,然后写到文件内】
    import json
    li = [11,22,33]
    json.dump(li,open('db','w'))
  1. json.load,先打开这个文件,然后把字符串转换成列表】
    import json
    li = json.load(open('db','r'))
    print(type(li),li)
  2.  
  3. pickle,序列化,只能在python平台使用:
  4.  
  5. pickle.dumps,序列化成字符串】
    import pickle
    li = [11,22,33]
    r = pickle.dumps(li)
    print(r,type(r))
    结果:b'\x80\x03]q\x00(K\x0bK\x16K!e.' <class 'bytes'>
  1. pickle.loads,反序列化】
    import pickle
    li = [11,22,33]
    r = pickle.dumps(li)
    result = pickle.loads(r)
    print(result,type(result))
  1. pickle.dump,序列化至文件内,】
    import pickle
    lt = [22,33,44]
    pickle.dump(lt,open('db','wb')) #这里要加“b”
  1. pickle.load,读文件,也要加b
    import pickle
    ret = pickle.load(open('db','rb'))
    print(ret,type(ret))
  2.  
  3. 总结:
    #json:更加适合跨语言序列化,但是只支持基本数据类型序列化
    #pickle仅适用于python,pickle支持所有的python数据类型序列化;

python时间处理之time模块:

  1. import time
  2. 【返回时间戳】
  3. print(time.time())
  4.  
  5. 【返回当前时间】
  6. print(time.ctime())
  7.  
  8. 【返回一天前的时间】
  9. print(time.ctime(time.time()-86400))
  10.  
  11. 【函数返回time.struct_time类型的对象】
  12. time_obj = time.gmtime()
  13. print(time_obj)
  14. 结果:time.struct_time(tm_year=2016, tm_mon=7, tm_mday=27, tm_hour=8, tm_min=52, tm_sec=26, tm_wday=2, tm_yday=209, tm_isdst=0)
  15. 格式化输出:
  16. print(time_obj.tm_year,time_obj.tm_mon,time_obj.tm_mday)
  17.  
  18. print("{year}-{month}".format(year=time_obj.tm_year,month=time_obj.tm_mon))
  19.  
  20. 【以time.struct_time类型,打印本地时间】
  21. print(time.localtime())
  22.  
  23. 【转换成时间戳】
  24. time_obj = time.gmtime()
  25. print(time.mktime(time_obj))
  26.  
  27. 【延时2秒】
  28. time.sleep(2)
  29.  
  30. 【打印UTC,世界标准时间,北京时区是东八区,领先UTC八个小时】
  31. print(time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime()))
  32.  
  33. 【本地时间】
  34. print(time.strftime("%Y-%m-%d %H:%M:%S",time.localtime()))
  35.  
  36. 【把time.struct_time类型时间,转换成时间戳】
  37. tm = time.strptime("2016-05-6 15:06:33","%Y-%m-%d %H:%M:%S")
  38. print(tm)
  39. print(time.mktime(tm))

python时间处理之datetime模块:

  1. import datetime
  2.  
  3. 【打印当前,年,月,日】
  4. print(datetime.date.today())
  5.  
  6. 【打印当前时间,精确到微秒】
  7. current_time = datetime.datetime.now()
  8. print(current_time)
  9.  
  10. 【转成time.struct_time格式时间】
  11. current_time = datetime.datetime.now()
  12. print(current_time.timetuple())
  13.  
  14. 【加十天】
    print(datetime.datetime.now() +datetime.timedelta(days=10))
    【减十天】
    print(datetime.datetime.now() +datetime.timedelta(days=-10))
    【减十个小时】
    print(datetime.datetime.now() +datetime.timedelta(hours=-10))
    【加120s
    print(datetime.datetime.now() +datetime.timedelta(seconds=120))
  15.  
  16. 【替换成指定的时间】
    cr_time = datetime.datetime.now()
    print(cr_time.replace(2014,9,12))
    结果:2014-09-12 17:28:17.522893
  17.  
  18. 【格式化输出】
    print(datetime.datetime.strptime("21/11/06 16:30","%d/%m/%y %H:%M"))
  19.  
  20. 【替换成指定时间后,类型是<class 'datetime.datetime'>】
    current_time = datetime.datetime.now()
    time_obj = current_time.replace(2015,5)
    print(time_obj,type(time_obj))
    结果:2015-05-27 17:34:13.350245 <class 'datetime.datetime'>
  21.  
  22. 【对比时间大小,取指定时间范围使用】
    current_time = datetime.datetime.now()
    time_obj = current_time.replace(2015,5)
    print(current_time>time_obj)

python日志处理之logging模块

  1. 【打印日志】
  2. import logging
  3. logging.warning("user [alex] attempted wrong password more than 3 times")
  4. logging.critical("server is down")
  5.  
  6. 【这里定义只有级别是INFO以上的,才把日志写入到文件里面】
    import logging
    logging.basicConfig(filename='example.log',level=logging.INFO)
    logging.debug('This message should go to the log file')
    logging.info('So should this')
    logging.warning('And the, too')
  1. 【给打印日志加上,打印时间】
    import logging
    logging.basicConfig(filename='example.log',level=logging.INFO,
    format='%(asctime)s %(message)s',datefmt='%m/%d/%Y/ %I:%M:%S %p')
    #外国人的日期格式
    logging.debug('This message should go to the log file')
    logging.info('So should this')
    logging.warning('And the, too')

同时输出log到文件和屏幕:

  1. #!/usr/bin/python env
  2. #_*_coding:utf-8 _*_
  3.  
  4. # loggers:
  5. # handlers:把log发送到不同的地方;
  6. # filter:过滤文件内的特殊字符
  7. # formatters:格式化输出
  8. import logging
  9.  
  10. logger = logging.getLogger('TEST-LOG') #不指定是root;获取到logger对象
  11. logger.setLevel(logging.DEBUG) #设置一个全局打印日志级别
  12.  
  13. ch = logging.StreamHandler() #输出日志到屏幕
  14. ch.setLevel(logging.DEBUG) #设置屏幕输出的日志级别
  15.  
  16. fh = logging.FileHandler('access.log') #输出日志到文件
  17. fh.setLevel(logging.WARNING) #设置文件输出日志的级别
  18.  
  19. #增加一个error日志,这里需要改动
  20. fh_err = logging.FileHandler('error.log') #输出日志到文件
  21. fh_err.setLevel(logging.ERROR) #设置文件输出日志级别
  22.  
  23. formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
  24. formatter_for_file = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
  25. err_formatter = logging.Formatter('%(asctime)s - %(filename)s - %(funcName)s - %(lineno)s - %(name)s - %(levelname)s - %(message)s')
  26. #设置日志输出格式
  27. #%(asctime)s :时间格式
  28. #%(filename)s:执行程序的名称
  29. #%(funcName)s:定位函数
  30. #%(lineno)s:定义是哪行打印的
  31. #%(name)s :不指定是root,这里是上面定义的 TEST-LOG
  32. #%(levelname)s:日志级别
  33. #%(message)s:日志的详细信息
  34.  
  35. #增加一个error日志,这里需要改动
  36. ch.setFormatter(formatter) #设置屏幕输出日志格式,调用的上面
  37. fh.setFormatter(formatter_for_file) #设置文件输出日志格式,调用的上面
  38. fh_err.setFormatter(err_formatter) #设置error日志输入格式,调用的上面

  39. 【把这个日志打印到指定的handler里面,也就是文件里面】
  40. #增加打印一个error日志,这里需要改动
  41. logger.addHandler(ch) #打印到屏幕
  42. logger.addHandler(fh) #输出日志到access.log文件
  43. logger.addHandler(fh_err) #输出日志到error.log文件
  44.           
  45. logger.debug('debug message')
  46. logger.info('info message')
  47. logger.warn('warn message')
  48. logger.error('error message')
  49. logger.critical('critical message')

  50. 总结:
  51. #局部打印的优先级不能低于全局的,否则只会应用全局的日志打印级别
  52. #为什么要设置全局级别:可以操作输出日志到多个文件

日志格式化,可以使用的参数:

python笔记 - day5的更多相关文章

  1. python笔记 - day6

    python笔记 - day6 参考: http://www.cnblogs.com/wupeiqi/articles/5501365.html 大纲: 利用递归,实现阶乘: Python反射 pyt ...

  2. Python笔记之不可不练

    如果您已经有了一定的Python编程基础,那么本文就是为您的编程能力锦上添花,如果您刚刚开始对Python有一点点兴趣,不怕,Python的重点基础知识已经总结在博文<Python笔记之不可不知 ...

  3. boost.python笔记

    boost.python笔记 标签: boost.python,python, C++ 简介 Boost.python是什么? 它是boost库的一部分,随boost一起安装,用来实现C++和Pyth ...

  4. 20.Python笔记之SqlAlchemy使用

    Date:2016-03-27 Title:20.Python笔记之SqlAlchemy使用 Tags:python Category:Python 作者:刘耀 博客:www.liuyao.me 一. ...

  5. Python笔记——类定义

    Python笔记——类定义 一.类定义: class <类名>: <语句> 类实例化后,可以使用其属性,实际上,创建一个类之后,可以通过类名访问其属性 如果直接使用类名修改其属 ...

  6. 13.python笔记之pyyaml模块

    Date:2016-03-25 Title:13.Python笔记之Pyymal模块使用 Tags:Python Category:Python 博客地址:www.liuyao.me 作者:刘耀 YA ...

  7. 8.python笔记之面向对象基础

    title: 8.Python笔记之面向对象基础 date: 2016-02-21 15:10:35 tags: Python categories: Python --- 面向对象思维导图 (来自1 ...

  8. python笔记 - day8

    python笔记 - day8 参考: http://www.cnblogs.com/wupeiqi/p/4766801.html http://www.cnblogs.com/wupeiqi/art ...

  9. python笔记 - day7-1 之面向对象编程

    python笔记 - day7-1 之面向对象编程 什么时候用面向对象: 多个函数的参数相同: 当某一些函数具有相同参数时,可以使用面向对象的方式,将参数值一次性的封装到对象,以后去对象中取值即可: ...

随机推荐

  1. 【新产品发布】发布STM8S 核心板

    搞了一些STM8的核心板供大家把玩,先上几张图: 物品购买地址: http://item.taobao.com/item.htm?spm=686.1000925.1000774.17.5GMO5M&a ...

  2. CodeForces 670E Correct Bracket Sequence Editor(list和迭代器函数模拟)

    E. Correct Bracket Sequence Editor time limit per test 2 seconds memory limit per test 256 megabytes ...

  3. hdoj-1233-还是畅通工程

    题目:hdoj-1233 题解: 本题是典型的最小生成树问题,给出的是无向图,这里使用的方法是Prim最小生成树算法. Reference Prim算法参照:最小生成树-Prim算法和Kruskal算 ...

  4. 【翻译】CEDEC2014跨世代多平台并行开发PS4版如龙维新开发的一年

    本篇PPT讲述的是如龙4的开发过程中,集中在PS3和PS4并行开发中所遇到和解决的一些问题.如64位指针,DX9向DX11移植API的问题,以及在PS4上使用并行渲染在1080P下让FPS达到60等. ...

  5. A20板子上的触摸屏设备号变化后解决

  6. RT-Thread 线程的让出

    前面两个例子演示的线程调度是由系统“主动干预”的情况的线程切换,其实我们也可以根据实际情况,采用主动让出 CPU 使用权.RT-Thread 中的系统函数: rt_thread_yield(),可以让 ...

  7. python函数参数

    1.位置参数 2.默认参数 指向参数为不可变对象 3.可变参数 **args    一个列表list或是元组tuple 4.关键字参数 **kw,是一个字典dict 5.命名关键字参数 *,

  8. Apache Kafka源码分析 - ReplicaStateMachine

    startup 在onControllerFailover中被调用, /** * Invoked on successful controller election. First registers ...

  9. 【转】unity地形插件T4M使用帮助

    unity的地形系统在手机游戏中因为效率问题基本无法使用,只能通过T4M这个地形插件来进行优化制作.下面大概讲解一下使用流程及方法. 先中U3D里面用自带的地形系统刷出想要的地形和贴图.贴图可以大概刷 ...

  10. php学习笔记 [预定义数组(超全局数组)]

    <?php  预定义数组: * 自动全局变量---超全局数组 * * 1.包含了来自WEB服务器,客户端,运行环境和用户输入的数据 * 2.这些数组比较特别 * 3.全局范围内自动生效,都可以直 ...