Python教程
Python教程:包含了所有代写案例以及部分答案
-
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显示网络图片”
:
-
python通过pysftp加密上传、下载ftp服务器文件 import pysftp import sys # Defines the name of the file for download / upload remote_file = sys.argv[1] srv = pysftp.Connection(host="your_FTP_server", username="your_username", password="your_pa … 继续阅读“python通过pysftp加密上传、下载ftp服务器文件”
:
-
__author__ = ‘JanGin_Chan’ "’get the largest factor for the given non-prime number’" number = raw_input(‘please input a number:\n’) num = int(number) factor = num / 2 while factor > 1: if num % factor == 0: print ‘%s is the largest facto … 继续阅读“python 求一个数的最大公约数”
:
-
class JsonFormatter: def __init__(self,intend=4,name=""): self.name=name self.intend=intend self.stack=[] self.obj=None self.source=self.get_source(name) self.prepare() @staticmethod def json_str(s): return ‘"’+s+’"’ @staticmethod … 继续阅读“python自动格式化json文件”
: