摘要: #coding = utf-8 ''' ''' # 生产者消费者案例 import time import threading import random # 设定共享区 count = 0 # 获取条件变量对象 condition = threading.Condition() # 定义生产者线程 class Producer(threading.Thread): # 构造方法 ... 阅读全文
posted @ 2018-11-01 16:12 画轴 阅读(128) 评论(0) 推荐(0) 编辑
摘要: #coding = utf-8 import xlrd import csv # excel 转换 csv w = xlrd.open_workbook("data.xls") sheet = w.sheet_by_name(w.sheet_names()[0]) data = [] for row in range(1,sheet.nrows): d = {} for c... 阅读全文
posted @ 2018-10-31 21:11 画轴 阅读(435) 评论(0) 推荐(0) 编辑
摘要: import pickle d = dict(name='Bob', age=20, score=88) print(d) f = open('D:/untitled/1022/dump.txt', 'wb') #对象写入文件 pickle.dump(d,f) f.close() #文件读取 g = open('D:/untitled/1022/dump.txt', 'rb') e=pick... 阅读全文
posted @ 2018-10-31 21:08 画轴 阅读(2400) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8 import xlrd import json import csv #地址前用'\'转译符要加 workbook=xlrd.open_workbook('D:/untitled/1022/date.xls') #提取表格名称 sheets=workbook.sheet_names() #提取第一个表格内容 worksheet=workbook.sheet_by_n... 阅读全文
posted @ 2018-10-31 20:48 画轴 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #conding=utf-8 import logging import os,time logger=logging.getLogger(__name__) logger.setLevel(logging.INFO) formatter=logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ... 阅读全文
posted @ 2018-10-31 14:35 画轴 阅读(158) 评论(0) 推荐(0) 编辑
摘要: #conding=utf-8 #火车站信息显示 import requests #xls 文件读取 火车站代码导入 import xlrd import os #表格显示信息 from prettytable import PrettyTable #打开文件 workbook = xlrd.open_workbook(r'D:\untitled\hc.xls') #读取第一个页面 she... 阅读全文
posted @ 2018-10-31 14:25 画轴 阅读(195) 评论(0) 推荐(0) 编辑
摘要: #conding=utf-8from lxml import htmlimport requestsimport csvheader={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like 阅读全文
posted @ 2018-10-31 14:15 画轴 阅读(235) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8import threadingimport os,sysimport urllib.request as ur#显示调用函数def jindu(a,b,size): os.system('cls') per=100*a*b/size per=round(per, 2) i 阅读全文
posted @ 2018-10-29 22:52 画轴 阅读(1013) 评论(0) 推荐(0) 编辑
摘要: import requests,ossonglistd=[]header={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'}url='url=https://so.1ting.com/song/js... 阅读全文
posted @ 2018-10-29 20:19 画轴 阅读(701) 评论(0) 推荐(0) 编辑
摘要: import re,requests,os#头部模拟header={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'}#计数n=1#写入def down(iters): global n ... 阅读全文
posted @ 2018-10-29 20:02 画轴 阅读(273) 评论(0) 推荐(0) 编辑