摘要: !/usr/bin/env python -*-coding:UTF-8-*- 这一句告诉python用UTF-8编码 ========================================================================= NAME: Python MySQL test AUTHOR: beny... 阅读全文
posted @ 2009-12-14 13:25 文海 阅读(580) 评论(0) 推荐(0) 编辑
摘要: import web import os import time class files: def GET(self): ...... def POST(self): inp = web.input() uploaded = inp.fh fname = inp.filename if uploaded: _fl = open( os.path.jo... 阅读全文
posted @ 2009-12-14 13:18 文海 阅读(455) 评论(0) 推荐(0) 编辑
摘要: import win32comfrom win32com.client import Dispatch, constantsw = win32com.client.Dispatch('Word.Application')# 或者使用下面的方法,使用启动独立的进程:# w = win32com.client.DispatchEx('Word.Application')# 后... 阅读全文
posted @ 2009-12-14 13:11 文海 阅读(7785) 评论(0) 推荐(0) 编辑
摘要: 如果你掌握Java和Javascript,你就可以很快的用Python快速流畅地写有用的Python程序,虽然有点夸张不过本文也绝对是学习Python不可错过的好文章. 1 为什么使用Python 假设我们有这么一项任务:简单测试局域网中的电脑是否连通.这些电脑的ip范围从192.168.0.101到192.168.0.200. 思路:用shell编程.(Linux通常... 阅读全文
posted @ 2009-12-14 13:09 文海 阅读(282) 评论(0) 推荐(0) 编辑
摘要: Python语言: 简单的几句Python语句,模拟《骇客帝国》中的滚屏 #coding:utf-8##简单的几句Python语句,模拟滚动的Matrix屏保## 1. 打开Windows命令行(运行-》输入“cmd”然后回车)# 2. 打开命令行属性设置,设置背景为黑色,前景为绿色# 3. 执行这个脚本,就可以看到类似电影《骇客帝国》中的经典滚屏了 - 不过是反着的。。... 阅读全文
posted @ 2009-12-14 12:54 文海 阅读(446) 评论(0) 推荐(0) 编辑
摘要: Python语言: #! /usr/bin/env python# -*- coding: utf-8 -*-from win32gui import *titles = set()def foo(hwnd,nouse): #去掉下面这句就所有都输出了,但是我不需要那么多 if IsWindow(hwnd) and IsWindowEnabled(hwnd) and... 阅读全文
posted @ 2009-12-14 12:15 文海 阅读(3759) 评论(0) 推荐(0) 编辑
摘要: #listdir.pyimport os # 递归遍历指定的目录 # level -- 递归的层数,用这个参数来控制打印的缩进 # path == 遍历起始绝对路径 def listyoudir(level, path): for i in os.listdir(path): print ' '*(level+1) + i ... 阅读全文
posted @ 2009-12-14 12:10 文海 阅读(659) 评论(0) 推荐(0) 编辑
摘要: Python语言: windows平台下如何用Python杀进程 #from : http://www.joyloft.net/?p=1031# "这段代码来自于一个很简单的场景:# 在python中调一个程序。给这个程序设置一个timeout# 假如一段时间程序还没有返回,就杀掉这个这个新开的进程。# 本来以为我肯定不是第一个遇到这个问题的人,# 但是网... 阅读全文
posted @ 2009-12-14 12:06 文海 阅读(2052) 评论(0) 推荐(0) 编辑