#!/usr/bin/env python #coding:utf-8 import psutil import time import sys from optparse import OptionParser
exif-py是一个纯python实现的获取图片元数据的python库,官方下载地址: http://exif-py.svn.sourceforge.net/viewvc/exif-py/source/EXIF
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 w
''' @author: Administrator ''' #coding=utf-8 import os import shutil dir = "G://tmp//sz//ngtsverify" def removeDir(): for root, dirs, files in os.walk(dir, True, None, False): if 'CVS' in root: print(
python将html表格转换成CSV 使用方法:python html2csv.py *.html 这段代码使用了 HTMLParser 模块 #!/usr/bin/python # -*-
# -*- coding: utf-8 -*- import Image,ImageDraw,ImageFont import random import math, string class RandomChar(): """用于随机生成汉字""" @staticmethod def Unicode(): val = random.randint(0x4E00, 0x9FBF) return u
用python写的小程序,可以用这个程序在固定的目录之间来回的拷贝. copy one directory to another directory @author: ''' import os; import
class_config.py #!/usr/bin/env python #coding:utf-8 '''''此处定义邮件的相关参数''' class Mail_conf(): sender = 'fyxichen@126
目前的任务就是从表1复制出相应的数据,填到表2里面。如果手工复制粘贴,共计110x25=2750个数据,简直累哭。 所以使用Python写了一段程序,借助 xlrd模块 (用来读取表1) xlwt模块 (用来生成表2)来完成此项工作。
就是找到硬盘中所有的MP3文件和wma文件,再随机打开其中的一个。 import os,random disk=['D','E','F','G','H'] def search_file(filename,search_path,pathsep=os.pathsep): for path in search_path.split(pathsep): candidate = os.path.join
# -*- 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
[Python]代码 # _*_ coding:utf-8 _*_ #xiaohei.python.seo.call.me:) #win+python2.7.x number = "1350571" with
d(manages) print('all have finished!') quit() [Python]代码 运行结果: I am watching movie 捉妖记 now. I am watching
compile_env_config.py #!/usr/bin/python """ 2015.06.30 Modified some functions. Now this configration
[Python]代码 #!/usr/bin/env python #-*- coding:utf-8-*- import urllib2 import re import hashlib import
python shell 根据 ip 获取 hostname 或根据 hostname 获取 ip 前言 笔者有时候需要根据hostname获取ip 比如根据machine.company.com
#!/usr/bin/env python #coding: utf-8 ''' 【程序1】 题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? 1.程序分析:可填在
课上的知识了。为了想作一个效率不差的,而下载网页的性能瓶颈是在网络上,所有决定用Python编写代码。刚学python没几天,学习一种语言的最好方法就是写code.下面的是我用的多线程实现的网络爬虫,
< < Back to man.ChinaUnix.net 《Python编程金典》读书笔记 整理:Jims of 肥肥世家 第一次发布时间:2004年5月26日 ----------------
http://www.terryburton.co.uk/barcodewriter/ )的一个Python绑定。以下是一个简单的示例: >>> from elaphe import barcode