摘要: import sys reload(sys) sys.setdefaultencoding('utf8') import xlrd import xlwt book = xlrd.open_workbook('C:/Users/13717/Desktop/sg.xls') sheet = book.sheet_by_index(0) book1 = xlwt.Workbook() #创... 阅读全文
posted @ 2018-09-10 12:35 破晓e 阅读(287) 评论(0) 推荐(0) 编辑
摘要: import xlrd book = xlrd.open_workbook(file_path)#打开文件 sheet = book.sheet_by_index(0) #获取第一个工作簿 print sheet.nrows,sheet.ncols #打印行数,列数 for i in range(sheet.nrows): print sheet.row(i)[0].value ... 阅读全文
posted @ 2018-09-10 11:53 破晓e 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python# -*- encoding: utf-8 -*-# Created on 2018-08-19 14:47:28# Project: HBGGZY_SBJ import jsonimport pymongoimport hashlibfrom bs4 im 阅读全文
posted @ 2018-08-19 19:45 破晓e 阅读(170) 评论(0) 推荐(0) 编辑
摘要: #encoding:utf8import pymongoimport MySQLdbimport randomdef GetMongoData(): MyQuery = Mongo_Tab.find({'is_indb':"0"}) if MyQuery.count() > 0: return My 阅读全文
posted @ 2018-08-19 19:44 破晓e 阅读(119) 评论(0) 推荐(0) 编辑
摘要: class ProjectnameDownloaderMiddleware(object): # Not all methods need to be defined. If a method is not defined, # scrapy acts as if the downloader mi 阅读全文
posted @ 2018-08-16 22:30 破晓e 阅读(1274) 评论(0) 推荐(0) 编辑
摘要: 安装django-aliyun-oss2-storage-0.1.5.tar.gz settings文件添加 阅读全文
posted @ 2018-08-14 11:32 破晓e 阅读(162) 评论(0) 推荐(0) 编辑
摘要: import nltk Freq_dist_nltk = nltk.FreqDist(list) for k,y in Freq_dist_nltk: print str(k),str(y) 阅读全文
posted @ 2018-08-06 15:28 破晓e 阅读(434) 评论(0) 推荐(0) 编辑
摘要: 并行迭代 zip for a,b,c in zip(list,list,tuple,list): print a,b,c 串行迭代 itertools.chain a = [1,2,3,4,5] b = [2,3,4,5,6] for x in chain(a,b): print x 阅读全文
posted @ 2018-07-05 21:35 破晓e 阅读(130) 评论(0) 推荐(0) 编辑
摘要: from collections import Iteratorclass IterA(Iterator): def __init__(self,Itlist): self.Itlist = Itlist self.index = 0 def next(self): if self.index == 阅读全文
posted @ 2018-07-05 20:59 破晓e 阅读(73) 评论(0) 推荐(0) 编辑
摘要: a = (zhangsan,20,nv,123@163.com) 输出姓名 a[0] 输出年龄 a[1] 输出性别 a[2] ..... 这样写可读性非常低 使用 内置元祖子类 from collections import namedtuple Item = namedtuple('class_n 阅读全文
posted @ 2018-07-04 21:45 破晓e 阅读(108) 评论(0) 推荐(0) 编辑