Python教程
Python教程:包含了所有代写案例以及部分答案
-
from PIL import Image import qrcode #最小尺寸 1 会生成 21 * 21 的二维码,version 每增加 1,生成的二维码就会添加 4 尺寸 #参数 error_correction 指定二维码的容错系数,分别有以下4个系数: #ERROR_CORRECT_L: 7%的字码可被容错 #ERROR_CORRECT_M: 15%的字码可被容错 #ERROR_CORRECT_Q: 25%的字码可被容错 #ERROR_CORRECT_H: 30%的字码可被容错 # … 继续阅读“Python3使用qrcode生成二维码”
:
-
from PIL import Image, ImageFilter, ImageDraw, ImageFont, ImageEnhance, ImageFilter image1 = Image.open(‘C:/Users/hengli/Desktop/1.jpg’) image2 = Image.open(‘C:/Users/hengli/Desktop/2.jpg’) def 图片大小(image): w, h = image.size #获得图片的大小(分辨率) return w, h … 继续阅读“Python3.4 PIL的使用”
:
-
代码“`python import struct import ctypes def test_struct(buf, offset): return struct.unpack_from(“I”, buf, offset)[0] def test_ctypes(buf, offset): return ctypes.c_uint32.from_buffer(buf, offset).value def test_multi(buf, offset): ret … 继续阅读“Python将byte数组转换为int”
:
-
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import urllib2 import datetime import time import PyRSS2Gen from email.Utils import formatdate import re import sys import os reload(sys) sys.setdefaultencoding(‘utf-8’) class RssSpider(): def __i … 继续阅读“python抓取osc最新博客生成Rss”
:
-
#本代码获取百度乐彩网站上的信息,只获取最近100期的双色球 #http://trend.lecai.com/ssq/redBaseTrend.action?recentPhase=100&onlyBody=false&phaseOrder=up&coldHotOrder=number import urllib.request from bs4 import BeautifulSoup import random ere_hitlist = [] … 继续阅读“python 爬前100期双色球中奖号码,从中随机出下一期中奖号码”
:
-
# -*- coding: cp936 -*- #jk409 于2014-8-27用python2.7编写的批量复制文件和修改虚拟机配置文件的脚本 import os,os.path,shutil import re,time class main: def __init__(self,name,drive,sysos): self.name = name self.drive = drive self.dst_dir = self.drive+’:\\’+self.name+’\\’ self … 继续阅读“python2.7自动创建虚拟机”
:
-
#coding=utf-8 import urllib import re import os def getHtml(url): page = urllib.urlopen(url) html = page.read() return html def getVideo(html): reg = r’hurl=(.+?\.jpg)’ imgre = re.compile(reg) imglist = re.findall(imgre,html) return imglist for num i … 继续阅读“Python下载网易云音乐的高清MV”
:
-
#!/usr/bin/env python # coding: utf-8 # # author: Tim Wang # date: 2015-05-21 # filename: common_lib/net/sockettools.py import socket import sys from thread import start_new_thread import cPickle as pickle def mksocket(): try: return socket.socket(so … 继续阅读“python socket Service-Client”
:
-
#!/usr/bin/env python #_*_encoding:utf-8_*_ import smtplib import string FROM = raw_input("请输入您的邮箱地址:") FROM_PASS = raw_input("请输入您的邮箱密码:") HOST = raw_input("请输入您的邮箱SMTP服务器地址(例如:smtp.qq.com:):") TO = raw_input("请输入对 … 继续阅读“python 发送邮件”
: