Python 定时运行脚本
import sys
import os
import datetime
import time
class ArgsDealwith:
def arg_environment(self, args):
filepath = ('PYTHON_PATH', 'path')
for i in filepath:
filename = os.environ.get(i,"%s is null." % i)
print '%s:' % i,' ', filename
def arg_en(self, args):
filepath = ('PYTHON_PATH', 'path')
for i in filepath:
filename = os.environ.get(i,"%s is null." % i)
print '%s:' % i, ' ', ' '.join(filename.split(';'))
def arg_file(self, args):
if not args:
print 'Error: file name is null.'
else:
if len(args) == 1 and args[0].lower() == 'python_path':
filename = os.environ.get(args[0], None)
if filename:
args = filename.split(';')
else:
print 'Error: "%s" is null' % args[0]
&nbs
相关文档:
正则表达式
具体的参考手册,这里记下一些小问题:
1、re对象的方法
match Match a regular expression pattern to the beginning of a string.
search re.search(pattern, string, flags) flags:re.I re.M re.X re.S re.L re.U
sub Substitute oc ......
ZoundryDocument
Python skin is known for its color variations and for its elasticity; it is
the warmest leather of the season and ideal for the manufacture of many luxury
goods. Sometimes natural patterns can be hidden when they're done in black, but
the finish here has a bit of a shine to it ......
1. 事件驱动
一个事件及其回调的例子是鼠标移动。我们假设鼠标指针停在您GUI 程序的某处。如果鼠标被移到了程序的别处,一定是有什么东西引起了屏幕上指针的移动,从而表现这种位置的转移。系统必须处理这些鼠标移动事件才能展现(并实现)鼠标在窗口上的移动。一旦您释放了鼠标,就不再会有事件需要处 ......
1. 打印变量和变量自显
>>> myString = 'Hello World!'
>>> print myString
Hello World!
>>> myString
'Hello World!'
因为: print 语句调用str()函数显示对象,而交互式解释器则调用repr()函数来显示对象
sys.stdout.write('hello')不会在末尾加上'\n',而print会
2. 打印文件
hand ......
#coding=utf-8
from newtest.wiki.models import WiKi
from django.template import loader, Context
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
def index(request, pagename=""):
"""显示正常页面,对页面的文字做特殊的链接处理"""
......