Python教程
Python教程:包含了所有代写案例以及部分答案
-
import Tkinter class mybutton: def __init__(self,root,canvas,label,types): self.root=root self.canvas=canvas self.label=label if types==0: button=Tkinter.Button(root,text=’Drawline’,command=self.Drawline) elif types==1: button=Tkinter.Button(root,tex … 继续阅读“python 闲来无事,,,,一个“画图amp;quot;”
:
-
#/usr/bin/env python #coding:utf-8 import sys import os def getFileHashCode(filename,type): if not os.path.exists(filename): return [True,"找不到这个文件:"+filename] else: try: nameSpace=__import__("hashlib") except: return [True,"你 … 继续阅读“python 获取文件的MD5码等”
:
-
安装 https://pypi.python.org/pypi/redis/ https://github.com/andymccurdy/redis-py 参照官网,安装命令 sudopipinstallredis 或者 sudoeasy_installredis 亦或 源码包执行sudopythonsetup.pyinstall 实例python >>> import redis >>> r = redis.Redis(host=”172.16.64.17 … 继续阅读“python Redis的Python客户端实例”
:
-
import socket, traceback host = ” port = 51423 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((host, port)) while 1: try: message, address = s.recvfrom(8192) print ‘Got data from’, … 继续阅读“python udp 服务器”
:
-
import os from os.path import join, getsize def getdirsize(dir): size = 0L for root, dirs, files in os.walk(dir): size += sum([getsize(join(root, name)) for name in files]) return size if __name__ == ‘__main__’: filesize = getdirsize(r’c:\windows’) p … 继续阅读“python获取文件夹大小的代码”
:
-
#coding=utf-8 __author__ = ‘dehua.li’ from datetime import * import datetime import csv import sys import time import string import os import os.path import pylab as plt rootdir=’/nethome/dehua.li/orderlifeCycleData/xingzheng’ writeFileDir="/net … 继续阅读“python处理csv数据(不具备参考功能)”
:
-
python通过PIL缩放互联网上的图片并保存 ”’ tk_image_view_url_io_resize.py display an image from a URL using Tkinter, PIL and data_stream also resize the web image to fit a certain size display widget retaining its aspect ratio Pil facilitates resizing and allows fi … 继续阅读“python通过PIL缩放互联网上的图片并保存”
:
-
import poplib, string PopServerName = "mail.yourserver.com" PopServer = poplib.POP3(PopServerName) print PopServer.getwelcome() PopServer.user(‘yourName’) PopServer.pass_(‘yourPass’) r, items, octets = PopServer.list() msgid, size = string. … 继续阅读“python登录pop3邮件服务器接收邮件”
:
-
”’ tk_image_view_url_io.py display an image from a URL using Tkinter, PIL and data_stream tested with Python27 and Python33 by vegaseat 01mar2013 ”’ import io # allows for image formats other than gif from PIL import Image, ImageTk try: # Python2 i … 继续阅读“python通过Tkinter显示网络图片”
: