Python教程
Python教程:包含了所有代写案例以及部分答案
-
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import ConfigParser # Open a configuration file config = ConfigParser.SafeConfigParser() config.read("config.ini") # Read the whole configuration file for section in config.sections(): print &q … 继续阅读“python读取ini配置文件”
:
-
import re import os import urllib.request # 小说目录 home = "http://www.23zw.com/olread/9/9068/" if __name__ == ‘__main__’: url = home + "index.html" page = urllib.request.urlopen(url).read() page = page.decode("gbk") prin … 继续阅读“python 下载小说到本地”
:
-
#coding=UTF-8 import poplib import re import string import time from subprocess import Popen from subprocess import PIPE import win32api import win32con ####第一部分:收取邮件,获取最新一封的标题,使用poplib模块#### host=’pop3.163.com’ #这里以163邮箱举例 username=’邮箱账号’ password=’ … 继续阅读“python 利用手机远程控制电脑干坏事”
:
-
本代码演示了python的urllib2模块如何使用代理,以及需要登录验证的proxy # The proxy address and port: proxy_info = { ‘host’ : ‘proxy.myisp.com’, ‘port’ : 3128 } # We create a handler for the proxy proxy_support = urllib2.ProxyHandler({"http" : "http://%(host)s:%( … 继续阅读“python urllib2使用代理服务器”
:
-
def prime(b): t=b/2 for i in range(2,t+1): if b%i==0: break else: return b if __name__=="__main__": a=input(‘please input the first number:’) b=input(‘please input the next number:’) list=[] for i in range(a,b+1): if prime(i): list.append(p … 继续阅读“python 找出a-b之间的质数”
:
-
pil功能强大,convert方法可以轻易的将图片转换,下面的代码可以将图片转换成黑白效果 from PIL import Image image_file = Image.open("convert_image.png") # open colour image image_file = image_file.convert(‘1’) # convert image to black and white image_file.save(‘result.png’) 标签:py … 继续阅读“python通过pil将图片转换成黑白效果”
:
-
#coding:utf-8 ”’ arp欺骗局域网pc,将伪造的网关mac以网关的arp应答发送给pc ”’ from scapy.all import ARP,send,arping import sys,re stdout=sys.stdout IPADDR="192.168.1.*" gateway_ip=’192.168.1.1′ #伪造网关mac地址 gateway_hw=’00:11:22:33:44:55′ p=ARP(op = 2,hwsrc = gate … 继续阅读“python arp欺骗伪造网关代码”
:
-
from email.mime.text import MIMEText import smtplib import getpass msg = MIMEText(‘这是一封来自python的纯文本邮件’,’plain’,’utf-8′) from_addr = ‘发件人邮箱地址’ password = getpass.getpass(‘Password:’) smtp_server = ‘smtp.163.com’ smtp_port = 994 to_addr = ‘收件人邮箱地址*’ se … 继续阅读“Python SMTP 发送纯文本”
:
-
#!/usr/bin/env python import os import os.path import urllib import socket import imghdr from multiprocessing import Pool from urlparse import urlparse results = [] exceptions = [] def callback(result): print ‘result:’, result if result: results.appe … 继续阅读“python 128进程,图片爬虫,增量更新,可作为标准组件”
: