摘要: 关于编码(首先了解一下ascii、gb2312、gbk、utf-8、unicode的关系 http://www.cnblogs.com/skynet/archive/2011/05/03/2035105.html#_3.4.UTF-8)a.命令行中编码>>> import sys >>> sys.getdefaultencoding() 'ascii' >>> a='nihao中国' >>> a 'nihao\xd6\xd0\xb9\xfa' //‘nihao’是按ascii 阅读全文
posted @ 2013-04-22 21:31 bubu_步步 阅读(21347) 评论(0) 推荐(0)
摘要: 1 insert 语句首先要知道mysql有个user表专门存储用户信息的,按说可以直接向 mysql.user表中插入new user,但是因为字段比较多,外加一些未知的限制,很容易出错(至少我还没尝试成功);并且如果使用这种方法创建新用户,必须执行 flush privileges 来告诉server to reload the grant tables。相关:1) 基本语法:创建用户:INSERT INTO mysql.user (Host,User,Password) -> VALUES('localhost','user_name',passwo 阅读全文
posted @ 2013-04-17 17:04 bubu_步步 阅读(240) 评论(0) 推荐(0)
摘要: 1 首先查看创建函数的功能是否开启>show variables like '%func%';默认为log_bin_trust_function_creators=off,可开启>set global log_bin_trust_function_creators=1;2 创建函数当然,你要在需要的数据库下创建这里,先了解并 推荐使用 'delimiter $$',表示设置 $$ (可以自行定义)为命令终止符号,代替分号(我们经常在begin..end中用到分号);用完之后你还可以通过 'delimiter ;' 恢复为原来的命令终止 阅读全文
posted @ 2013-04-17 10:07 bubu_步步 阅读(177) 评论(0) 推荐(0)
摘要: http://blog.sina.com.cn/s/blog_52d20fbf0100ofd5.html 阅读全文
posted @ 2013-04-16 17:27 bubu_步步 阅读(135) 评论(0) 推荐(0)
摘要: mysql5新添加的功能。1 创建基本语法:create trigger trigger_name trigger_time trigger_eventon table_name for each row trigger_stmttrigger_name:自行定义触发器名字;trigger_time:标识触发时机,before 或 after;trigger_event:标识触发事件,insert,update 或 delete;table_name:标识建立触发器的表名;trigger_stmt:触发器程序体,可用begin和end作为开始和结束。2 实例(a copy)CREATE /*! 阅读全文
posted @ 2013-04-16 14:34 bubu_步步 阅读(547) 评论(0) 推荐(0)
摘要: 1. 单表查询常用到 where / group by / order by / having / between / in / like / and / or / > < = / is nullgroup by 分组查询子句having 用于指定分组子句的条件order by 根据一或多列对查询结果进行排序2. 多表查询——连接查询1)笛卡尔积查询:不常用2)内连接:查询与连接条件匹配的数据行select* from tableA inner join tableB on A.id=B.id3)外连接:返回结果集合的不仅包含符合连接条件的行,还包括左表(left join)、右表 阅读全文
posted @ 2013-04-16 11:27 bubu_步步 阅读(134) 评论(0) 推荐(0)
摘要: 1 distinct查找不重复的行distinct(列名)2 and / or多个条件的选择SELECT"栏位名"FROM"表格名"WHERE"简单条件"{[AND|OR]"简单条件"}+{}+代表{}之内的情况会发生一或多次用()来代表条件的先后次序3 in不连续(discrete)的值SELECT"栏位名"FROM"表格名"WHERE"栏位名"IN('值一','值二',...)4 between连续的范围(range)内 阅读全文
posted @ 2013-04-12 12:22 bubu_步步 阅读(315) 评论(0) 推荐(0)
摘要: 除了正则可以使用findall(), ElementTree也使用findall()字符串对象只能使用find()>>>xml_str="""<a> <b>1</b> <b>2</b> <c> <d> <b>3</b> <b>4</b> </d> <e> <b>5</b> <b>6</b> </e> </c></a& 阅读全文
posted @ 2013-03-27 15:23 bubu_步步 阅读(1274) 评论(0) 推荐(0)
摘要: http://lengyueblog.eicp.net/?p=44其中有一个关于date类型数据的小细节,值得留意 阅读全文
posted @ 2013-03-27 15:21 bubu_步步 阅读(654) 评论(0) 推荐(0)
摘要: http://www.lisdn.com/html/55/n-155.htmlpython开发常用资源http://www.lisdn.com/html/00/n-11200.htmlpython开发工具 阅读全文
posted @ 2013-03-27 15:20 bubu_步步 阅读(119) 评论(0) 推荐(0)