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
相关文档:
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 ......
继前篇《Import Module》(http://blog.csdn.net/xiadasong007/archive/2009/09/02/4512797.aspx),继续分析嵌入部分基础知识。这次不多说,有什么问题记得多查英文资料,国内的这方面知识少
还是来看代码,写完我就睡觉了~
#include "python/python.h"
#include <iostream>
using namespace std;
int ......
1. 打印变量和变量自显
>>> myString = 'Hello World!'
>>> print myString
Hello World!
>>> myString
'Hello World!'
因为: print 语句调用str()函数显示对象,而交互式解释器则调用repr()函数来显示对象
sys.stdout.write('hello')不会在末尾加上'\n',而print会
2. 打印文件
hand ......
客户给一堆图片要传到后台,图片太大了,上百张图用photoshop改太慢,就想到用python写个简单的批处理。功能简单就是把原图按比例缩小,代码更简单 20多行。
# -*- coding: cp936 -*-
import Image
import glob, os
#图片批处理
def timage():
for files in glob.glob('D:\\1\\*.JPG'):
filepath,filena ......