01 2016 档案

摘要:7-1update()方法,不过key相同的话,会用后面的value覆盖前面的7-2字典,列表不行,元组可以因为字典和列表是可变的,元组是不可变的,不可变的对象能作为字典的键7-37-47-5略7-6略7-77-8 1 def dit(): 2 dict1 = {} 3 while ... 阅读全文
posted @ 2016-01-25 16:11 hell0x 阅读(152) 评论(0) 推荐(0)
摘要:1 <?php 2 function my_scandir($dir){ 3 $files = array(); 4 if(is_dir($dir)){ 5 if($handle=opendir($dir)){ 6 while(($file=readdir($handle))!==false){ 7 阅读全文
posted @ 2016-01-20 11:25 hell0x 阅读(233) 评论(0) 推荐(0)
摘要:6-1成员操作符in可以判断一个字符串是否是另一个字符串的一部分。返回true或false。6-2 1 import string 2 import keyword 3 4 myInput = raw_input("Please input the string: ") 5 6 if len(m... 阅读全文
posted @ 2016-01-18 15:47 hell0x 阅读(239) 评论(0) 推荐(0)
摘要:1.file_get_contents得到文件的内容 1 <?php 2 header("content-type:text/html;charset=utf-8"); 3 4 $file_path = 'lock.txt'; 5 6 $conn = file_get_contents($file_ 阅读全文
posted @ 2016-01-16 11:55 hell0x 阅读(924) 评论(0) 推荐(0)
摘要:PHP上传文件改进版: 阅读全文
posted @ 2016-01-13 14:29 hell0x 阅读(151) 评论(0) 推荐(0)
摘要:restaurant_ratings表 使用IN: 1 SELECT `name`, rating FROM restaurant_ratings 2 WHERE rating IN 3 (SELECT rating FROM restaurant_ratings 4 WHERE rating > 阅读全文
posted @ 2016-01-12 15:41 hell0x 阅读(157) 评论(0) 推荐(0)
摘要:用None作为索引值,可以在第一次迭代的时候显示整个字符串:切片中若起始/结束索引都没有指定的话会返回整个字符串。导入string模块:一般来说,从性能的角度来考虑,把重复操作作为参数放到循环里进行是十分低效的,如果把需要操作的运算作为一个值保存,可以使循环操作更高效。python语法允许你在源码中... 阅读全文
posted @ 2016-01-07 16:29 hell0x 阅读(155) 评论(0) 推荐(0)
摘要:MySQL设定根用户密码:SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');添加新用户:CREATE USER wei IDENTIFIED BY 'wei';授予权限:GRANT使用GRANT语句可以控制用户对表和列可执行的操作。用户被授... 阅读全文
posted @ 2016-01-05 15:20 hell0x 阅读(146) 评论(0) 推荐(0)