摘要: 1、数组中元素不可以是引用(引用不可以作为数组元素的原因是它不支持传统意义的复制(内存分配)) 2、数组名可以是引用 阅读全文
posted @ 2017-05-16 10:59 gaoyanglao 阅读(603) 评论(0) 推荐(0) 编辑
摘要: 1、print如何不换行 print函数中end="\n"(换行)为默认值,如果不想换行,修改此默认值 for i in range(1, 5): print("*", end = '') 输出 **** 2、and-or 的使用 a = 1 b = 2 c = True and a or b 返回 阅读全文
posted @ 2017-05-05 10:37 gaoyanglao 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1、使用 PyInstaller 2、使用 py2exe 阅读全文
posted @ 2017-05-03 14:03 gaoyanglao 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 1、if 判断 lua中 nil 和 false 为 假,其余为真 2、table是否为空 local a = {} 正确是 if next(a) == nil then xx end 而不是 if a == {} then xx end 3、table长度 t = {1, 2, 3} t[1] = 阅读全文
posted @ 2017-03-31 21:34 gaoyanglao 阅读(197) 评论(0) 推荐(0) 编辑
摘要: python 生成 md5 码有两种方法 m = md5.new([arg]) // 返回一个md5对象,如果给出参数,相当于调用 update(arg) m.update(arg) // arg 为 string 参数,即要计算的 arg信息的摘要 print(m.hexdigest()) // 阅读全文
posted @ 2017-02-27 07:30 gaoyanglao 阅读(751) 评论(0) 推荐(0) 编辑
摘要: 1、table.sort (table [, comp]) 注意事项 它要求排序的目标table的必须是从1到n连续的,即中间不能有nil,table.sort默认按照升序排序 当额外提供比较函数时,相当于重载了lua中自带的“<”操作符。当两个数相等的时候,比较函数须返回false(即>=) 2、 阅读全文
posted @ 2017-02-22 18:02 gaoyanglao 阅读(2401) 评论(0) 推荐(0) 编辑
摘要: 查看 /etc/inittab 文件,如下图 由上图可以看到 1、两种模式分别如下 multi-user.target: analogous to runlevel 3 # 命令行模式 graphical.target: analogous to runlevel 5 # 图形模式 2、查看当前模式 阅读全文
posted @ 2017-02-22 10:19 gaoyanglao 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 3.1 json.dumps()、json.loads() 3.2 json.dump()、json.load() 阅读全文
posted @ 2017-01-24 17:05 gaoyanglao 阅读(295) 评论(0) 推荐(0) 编辑
摘要: python -V # -*- coding: utf-8 -*- 或 # coding = utf-8 文档链接:https://www.python.org/dev/peps/pep-0263/ _num num # 这里是注释部分 toatl = num1 + \ num2 + \ num3 阅读全文
posted @ 2017-01-16 10:30 gaoyanglao 阅读(174) 评论(0) 推荐(0) 编辑
摘要: print"hello world" 同 print("hello world") type{} 同 type({}) 2.1 多赋值中,函数为最后一个表达式,则返回所有值,否则只返回第一个值 local x, y = test() -- x = 1, y = 2, 3丢弃 local x, y, 阅读全文
posted @ 2017-01-15 18:28 gaoyanglao 阅读(250) 评论(0) 推荐(0) 编辑