11 2016 档案

摘要:mysql数据库中有的字段是NULL, 有的字段是空白 写Python脚本,fetchall()得到结果,也是不同。 NULL对应的是None, 空白对应的是‘’ (None, '') 所以根据结果进行判断,也要不同。 阅读全文
posted @ 2016-11-25 14:11 guohuino2 阅读(9983) 评论(0) 推荐(0)
摘要:一般的读取文件的方法: with open(file_path, "r") as f: print f.read() 或者 with open(file_path,"r") as f: for line in f.readlines(): print line read()是一次性把文件内容以字符串 阅读全文
posted @ 2016-11-08 15:22 guohuino2 阅读(8264) 评论(0) 推荐(0)
摘要:time 模块,理解容易 import time time_start = time.time() time_end = time.time() time_use = time_end - time_start 或者 time_start =time.clock() time_use = time. 阅读全文
posted @ 2016-11-08 14:40 guohuino2 阅读(2012) 评论(0) 推荐(0)
摘要:fd = open("C:\Users\william\Desktop\dup_file - Copy (3).txt","r")for i in fd: print i 耗时 25.6074296742s fd = open("C:\Users\william\Desktop\dup_file - 阅读全文
posted @ 2016-11-08 14:20 guohuino2 阅读(999) 评论(0) 推荐(0)
摘要:fd = open("C:\Users\william\Desktop\dup_file - Copy (2).txt")for i in xrange(0,len(fd.readlines())): print i print fd.readline(), 在研究xrange(0,10000)循环 阅读全文
posted @ 2016-11-08 14:11 guohuino2 阅读(497) 评论(0) 推荐(0)
摘要:文件中共有4行内容。 fd = open("C:\Users\william\Desktop\dup_file - Copy (2).txt")for i in xrange(0,5): print type(fd.readline()) print fd.readline() print " " 阅读全文
posted @ 2016-11-08 14:07 guohuino2 阅读(2735) 评论(0) 推荐(0)
摘要:range(start,stop,step) range(0,8) >>print range(0,8) [0,1,2,3,4,5,6,7] range()返回一个数字列表。 start 默认0,stop不可缺少,step默认为1 xrange(start,stop,step) xrange(0,8 阅读全文
posted @ 2016-11-08 13:33 guohuino2 阅读(244) 评论(0) 推荐(0)
摘要:一 首先要了解什么是盗链 盗链是指服务提供商自己不提供服务的内容,通过技术手段绕过其它有利益的最终用户界面(如广告),直接在自己的网站上向最终用户提供其它服务商的服务内容,骗取最终用户的浏览和点击率。受益者不提供资源或者提供很少的资源,而真正的服务提供商却得不到任何的利益。 最熟悉的,就是盗版网络小 阅读全文
posted @ 2016-11-03 16:17 guohuino2 阅读(3519) 评论(0) 推荐(0)
摘要:上章总结了python中time模块的使用,这次总结日历模块 calendar >>> import calendar >>> cal = calendar.month(2016,1)>>> cal January 2016\nMo Tu We Th Fr Sa Su\n 1 2 3\n 4 5 6 阅读全文
posted @ 2016-11-01 15:00 guohuino2 阅读(388) 评论(0) 推荐(0)
摘要:当写了一个script执行时,如果时间很长时,想了解执行过程用了多久,一般用下面的方法 这里显示的时间是秒s。 就此另外了解一下时间,日期的其它用法 >>> time.time()1477978158.454 这是一个时间戳,看不出具体意思 >>> time.localtime(time.time( 阅读全文
posted @ 2016-11-01 14:44 guohuino2 阅读(341) 评论(0) 推荐(0)