摘要: 对所使用的字符串类型调用encode()方法进行转换即可 阅读全文
posted @ 2018-03-04 11:36 Dsp Tian 阅读(875) 评论(0) 推荐(0) 编辑
摘要: import zlib import os ss = 's' * 1024 * 1024 #写入原始文件 file = open("src.dat", "wb") file.write(ss.encode()) file.close() #读取上一步原始的文件 file = open("src.dat", "rb") sss = file.read(os.path.getsize("... 阅读全文
posted @ 2018-03-04 11:36 Dsp Tian 阅读(531) 评论(0) 推荐(0) 编辑
摘要: import cv2 img = cv2.imread("lena.jpg") cv2.namedWindow("Image") cv2.imshow("Image", img) cv2.waitKey(0) cv2.destroyAllWindows() 阅读全文
posted @ 2018-03-04 11:35 Dsp Tian 阅读(493) 评论(0) 推荐(0) 编辑
摘要: import sqlite3 from datetime import datetime conn = sqlite3.connect('data.db') print("Opened database successfully") for i in range(100): time = datetime.now() conn.execute("INSERT INTO t... 阅读全文
posted @ 2018-03-04 11:35 Dsp Tian 阅读(635) 评论(0) 推荐(0) 编辑
摘要: from datetime import datetime from apscheduler.schedulers.blocking import BlockingScheduler def tick(): print(datetime.now()) if __name__ == '__main__': scheduler = BlockingScheduler(... 阅读全文
posted @ 2018-03-04 11:34 Dsp Tian 阅读(374) 评论(0) 推荐(0) 编辑
摘要: import threading import time class myThread (threading.Thread): #继承父类threading.Thread def __init__(self, threadID, name): threading.Thread.__init__(self) self.name = name ... 阅读全文
posted @ 2018-03-04 11:33 Dsp Tian 阅读(349) 评论(0) 推荐(0) 编辑
摘要: import requests import bs4 import urllib.request import urllib import os hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHT 阅读全文
posted @ 2018-03-04 11:31 Dsp Tian 阅读(501) 评论(0) 推荐(0) 编辑
摘要: 源地址:http://www.cnblogs.com/thinksasa/archive/2013/08/26/3283695.html 方法:新建一个register.py 文件,把一下代码贴进去,保存 (代码来自:http://effbot.org/zone/python-register.ht 阅读全文
posted @ 2018-03-04 11:30 Dsp Tian 阅读(305) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: cp936 -*- import sys,os,string d=0; path="F://test" srcfile=os.listdir(path) for i in srcfile: src=path+"//"+i dst=path+"//"+str(d)+".txt" os.rename(src,dst) d=d+1; ... 阅读全文
posted @ 2018-03-04 11:28 Dsp Tian 阅读(411) 评论(0) 推荐(0) 编辑