自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(67)
  • 问答 (1)
  • 收藏
  • 关注

转载 python_class

@property把对象封装为属性,@classmethod类对象class School: school_id = 123456 def __init__(self, name, addr, type): self.name = name self.addr = addr self.type = type @pr...

2018-08-04 08:40:00 101

转载 验证码

import randomdef gen_check(): alpha_list = [i for i in range(65,123) if i<91 or i>96] check_str = "" for i in range(5): alpha = chr(random.choice(alpha_list ))...

2018-07-30 13:32:00 139

转载 装饰器之认证

auth_status = {"username":None,"stat":False}def auth(type): def auth_proc(func): def wrapper(*args,**kwargs): #已经认证通过 if auth_status["username"] and ...

2018-07-29 15:15:00 148

转载 阶乘

方法1 2 3def recur_fac(num,res=1): if num == 1: return res res = res * num return recur_fac(num - 1,res)print(recur_fac(12))from functools import reducepri...

2018-07-28 13:44:00 98

转载 计算比例

1 def read_data(): 2 with open("test","r",encoding="utf-8") as f : 3 for data in f: 4 yield data 5 6 g = read_data() 7 8 all_population = sum(eval(dt)["...

2018-07-28 08:56:00 141

转载 查看日志

1 f = open("text_file.txt","rb" ) 2 3 for ln in f: 4 offs = -10 5 while True: 6 print(offs) 7 f.seek(offs,2) 8 data = f.readlines() 9 ...

2018-07-28 08:53:00 80

转载 计算指定范围内能整除的个数及总和

计算指定范围内能被3 和 7 整除的个数及总和1、递归实现: 1 def count_and_sum(start,end,a=0,b=0): 2 if start == end: 3 return a,b 4 5 if start%3 == 0 and start%7 == 0:...

2018-07-28 08:25:00 1406

转载 三级菜单

#Author:xiesongyouChina= { '山东' : { '青岛' : ['四方','黄岛','崂山','李沧','城阳'], '济南' : ['历城','槐荫','高新','长青','章丘'], '烟台' : ['龙口','莱山','牟平','蓬莱','招远'] }, '江苏' ...

2018-01-21 17:31:00 89

转载 用户登录程序,读取文件用户名,锁定写入文件

读取文件:mport jsonuser_list = { 'andy': "123456", 'william':'123456', 'abc': "123456", 'bcd':'123456', 'cde': '123456', 'def': "123456", 'efg': '123456', }jsObj = json.dump...

2018-01-21 10:11:00 180

转载 九九乘法表

#Atuhor:xiesongyoufor i in range(1,10): for j in range(1,i+1): print("%d * %d = %-8d"%(j,i,i*j),end="") print()print("- - " * 35)for i in range(9,0,-1): for j in range(1,i+1): ...

2018-01-20 11:55:00 61

转载 pyqt5 初始

import sysfrom PyQt5.QtWidgets import (QWidget, QToolTip,QMessageBox, QPushButton, QApplication,QDesktopWidget)from PyQt5.QtGui import QFont,QIconfrom PyQt5.QtCore imp...

2018-01-05 19:00:00 100

转载 pyqt - QDate,QTime,QdateTime

from PyQt5.QtCore import QDate, QTime, QDateTime, Qtnow = QDate.currentDate()print(now.toString(Qt.ISODate))print(now.toString(Qt.DefaultLocaleLongDate))datetime = QDateTime.currentDateTime()prin...

2018-01-04 23:20:00 739

转载 python -pptx --from pptx.enum.text import PP_PARAGRAPH_ALIGNMENT

from pptx import *from pptx.util import Pt,Inchesfrom pptx.dml.color import RGBColorfrom pptx.chart.data import ChartDatafrom pptx.enum.shapes import MSO_AUTO_SHAPE_TYPEfrom pptx.enum.text import...

2017-12-29 08:11:00 748

转载 python 读取chart series的值

prs = Presentation('temp.pptx')xl=xlrd.open_workbook('11月分报告数据.xlsx')#幻灯片3slide=prs.slides[2]j=0for shape in slide.shapes: if not shape.has_chart: continue else: if j==0: ...

2017-12-27 13:11:00 652

转载 pptx-修改-text_box

prs = Presentation('2017年北科建第一阶段满意度调研报告V.7.0汇报.pptx')slide=prs.slides[2]j=1for shape in slide.shapes: if not shape.has_text_frame: continue text_frame = shape.text_frame print(str...

2017-12-25 11:30:00 242

转载 pptx-table

prs = Presentation('2017年北科建第一阶段满意度调研报告V.7.0汇报.pptx')slide=prs.slides[4]for shape in slide.shapes: if not shape.has_table: continue else: t = shape.table p = t.cell(2, ...

2017-12-25 09:26:00 164

转载 Python --pptx--同一序列多数据

from pptx import Presentationfrom pptx.util import Inchesfrom pptx.enum.text import MSO_AUTO_SIZEfrom pptx.enum.chart import XL_TICK_MARKfrom pptx.util import Ptfrom pptx.chart.data import ChartD...

2017-12-24 21:08:00 202

转载 python-pptx---条形图处理+

prs = Presentation('2017年北科建第一阶段满意度调研报告V.7.0汇报.pptx')slide=prs.slides[8]for shape in slide.shapes: if not shape.has_chart: continue else: chart = shape.chartchart_data = Chart...

2017-12-24 18:36:00 571

转载 python-pptx-bar

from pptx import Presentationfrom pptx.util import Inchesfrom pptx.chart.data import ChartDatafrom pptx.enum.chart import XL_TICK_MARKfrom pptx.util import Ptfrom pptx.dml.color import RGBColorfr...

2017-12-20 08:25:00 134

转载 python -pptx

from pptx import Presentationfrom pptx.util import Inchesfrom pptx.chart.data import ChartDatafrom pptx.enum.chart import XL_TICK_MARKfrom pptx.util import Ptfrom pptx.dml.color import RGBColorfr...

2017-12-17 19:22:00 281

转载 python bar1

import numpy as npimport matplotlib.pyplot as pltfrom pylab import mplfrom matplotlib.font_manager import FontPropertiesfont = FontProperties(fname=r"C:\\WINDOWS\\Fonts\\STXINGKA.TTF", size=14)#...

2017-12-16 16:19:00 111

转载 python -- 京东图书

# -*- coding: utf-8 -*-import scrapyimport urllib.requestimport reimport randomfrom jdgoods.items import JdgoodsItemfrom lxml import etreefrom scrapy.http import Requestclass GoodsSpider(scrapy.S...

2017-12-10 23:28:00 69

转载 Python 爬虫验证码登录

# -*- coding: utf-8 -*-import scrapyfrom scrapy.http import Request,FormRequestimport urllib.requestclass DbSpider(scrapy.Spider): name = 'db' allowed_domains = ['douban.com'] #start_url...

2017-12-08 08:24:00 188

转载 matplotlib.pyplot

matplotlib 绘图颜色和样式charactercolor‘b’blue‘g’green‘r’red‘c’cyan‘m’magenta‘y’yellow‘k’black‘w’whitecharacterdescrip...

2017-12-05 08:38:00 64

转载 python 自动登录

import scrapyfrom scrapy.http import Request,FormRequestclass TySpider(scrapy.Spider): name = 'ty' allowed_domains = ['iqianyue.com'] #start_urls = ['http://iqianyue.com/'] header={ '...

2017-12-02 08:23:00 144

转载 python - pptx

from pptx import Presentationfrom pptx.util import Ptfrom docx.shared import Inchesprs=Presentation() slide=prs.slides.add_slide(prs.slide_layouts[1])shape_txt=slide.shapes.placeholdersshape_txt...

2017-11-29 21:11:00 127

转载 scrapy 爬虫并把所有网址和所有图片对应起来写入到Excel中

items.py 数据条目import scrapyclass DangdangItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() title=scrapy.Field() link =scrapy.Field() com...

2017-11-26 15:26:00 258

转载 list 去重

import relst = ['http://img3m9.ddimg.cn/53/33/1354578839-1_x.jpg', 'http://img3m9.ddimg.cn/63/34/1354579839-1_x.jpg', 'http://img3m9.ddimg.cn/70/31/1354580539-1_x.jpg', 'http://...

2017-11-25 22:23:00 48

转载 python 微信爬虫

import urllib.requestimport reimport randomimport urllib.erroruapools=[ 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWe...

2017-11-24 08:44:00 98

转载 Python 使用代理 图片爬虫

import urllib.requestimport reimport randomimport urllib.erroruapools=[ 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWe...

2017-11-23 20:36:00 157

转载 python 图片爬取

import urllib.requestimport reimport randomimport urllib.erroruapools=[ 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWe...

2017-11-23 20:26:00 72

转载 爬虫代理2

import urllib.requestdef ip(): thisip=urllib.request.urlopen('http://tvp.daxiangdaili.com/ip/?tid=559796713225033&num=1&foreign=only').read().decode() print(thisip) proxy=urllib....

2017-11-23 08:54:00 63

转载 python 爬虫 代理1

import randomimport urllib.requestippools=[ "39.104.50.71:8080", "39.104.50.160:8080", "39.104.14.202:8080", "39.104.50.137:8080", "39.104.50.29:8080"]def ip(ippools): thisip=ra...

2017-11-22 22:20:00 51

转载 Python 爬虫 多用户代理

import reimport urllib.requestimport randomfrom docx import Documentdocument = Document()document.add_heading('糗事百科',1)uapools=[ 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)', ...

2017-11-22 19:30:00 146

转载 python 爬虫--糗事百科段子

import reimport urllib.requestfrom docx import Documentheader=("User-Agent",'User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537....

2017-11-21 22:19:00 72

转载 Python 爬虫 CSDN 网页下载

import reimport urllib.requestimport urllib.errorurl="http://blog.csdn.net"header=("User-Agent",'User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0...

2017-11-21 18:10:00 94

转载 python 爬虫 浏览器伪装

import urllib.requesturl="http://blog.csdn.net"header=("User-Agent",'User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36')opn=...

2017-11-20 21:43:00 134

转载 python 爬虫 异常处理

import urllib.requestimport urllib.errortry: data =urllib.request.urlopen("http://blog.csdn.net").read() print(data.decode())except urllib.error.URLError as err: if hasattr(err,"code"):...

2017-11-20 21:42:00 79

转载 python 爬虫 --豆瓣出版社-写入Excel

import urllib.requestimport reimport xlwtdata=urllib.request.urlopen("https://read.douban.com/provider/all").read().decode()pat='<div class="name">[\u4e00-\u9fa5].*?</div>'new_data=re...

2017-11-17 08:26:00 139

转载 HTML -position

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> .pghd{ height:48px; backg...

2017-11-13 13:52:00 60

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除