您正在查看 "Python" 分类下的文章 2009-08-26 16:28 最早原型参考骨头的BLOG上的文章,然后东抄西抄,自己整理一下,做备份用 现已改成完全能在linux, win下正常运行的脚本, 还未在FreeBSD下测试
#!/usr/bin/env python
#coding:utf-8
import tarfile import smtplib import datetime import time import os import sys import shutil from email.Header import Header from email.MIMEText import MIMEText from email.MIMEMultipart import MIMEMultipart
source = ('iptables/','pf_server_scripts/')
t |
2009-08-05 13:10 2009-04-16 17:12 #!/usr/bin/python point=("/","/usr","/var","/tmp") dev=("/dev/hda1","/dev/hda2","/dev/hda3","/dev/hda6")
for inx in xrange(len(point)): print "%s = %s" % (point[inx], dev[inx] )
#for (v, k) in (point, dev): #print "%s = %s" % (v, k )
mydict = {} for i in xrange(len(point)): mydict[point[i]] = dev[i]
for d in mydict: print |
2009-02-26 21:58 [axlrose@mygentoo strtest] $ cat strtest.py
#!/usr/bin/env python
import os
src_str = raw_input("input string:")
def str_loop(mystr):
if not isinstance(mystr, str):
print "not string"
return ""
str_len = len(mystr)
for i in xrange(str_len):
|
2008-11-06 12:36 #!/usr/bin/env python
#--coding:utf-8
import sys
import os
import socket
def Proc(SrcFileName, DestFileName):
srcFileHandle = open(SrcFileName, 'rb')
destFileHanel = open(DestFileName, 'wb')
srcFileHandle.seek(0, 0)
print "now seek = %s" % (srcFileHandle.tell(), )
srcFileHandle.seek(0, 2)
fileLen = srcFileHandle.tell( |
2008-09-10 17:51 2008-08-29 12:45 检查下globals()或者locals()是否有该变量的定义
>>> a = 1
>>> locals().has_key('a')
True
>>> locals().has_key('small')
False
或者就用try...except,异常是NameError
|
2008-08-20 12:08 2008-08-17 11:59 2008-08-15 14:57 Python for S60
Please follow our opensource site for the latest Python for S60 -details.
Python for S60 brings the power and productivity ofthe Python programming language to the S60 platform. The tools enable rapid application development and prototyping, and the ability to create stand-alone S60 applications written in Python.
The device installation package includes the Python interpreter |
| | |