一.topK python实现 def topk(k, lst): top = [0 for i in range(k)] #生成一个长度为K 的有序列表 for item in lst: #循环将要取 排行榜的列表 for i in range(k-1,-1, -1): if item > top[i]: #在top 表中找到他的位置并插入 top.insert(i+1,item) top.pop(0) #删除值最小 索引为0的元素 break #找到了就打断 print(top) ret
#coding = 'utf-8' import csv # 使用list,只能读取列,而且是全文读取,csv.reader会自动把CSV内容生成数组 ''' df = csv.reader(open('F:\c_database\c2015.csv')) for data in df: print (data[3]) ''' #如果要读取某行,必须将CSV内容生成 DICT字典(2维) with open('F:\c_database\c2015.csv','r') as csvfile: r
mysql定时删除当前时间前分钟的数据 2013-01-31 0个评论 作者:上官车月 收藏 我要投稿 mysql定时删除当前时间前分钟的数据 Sql代码 www.2cto.com SET GLOBAL event_scheduler = ON; delimiter $$ drop event if exists e_wom_stat; create event e_wom_stat on schedule EVERY 1 day