python中常用日期操作总结
http://hbszyandong.javaeye.com/blog/377199
# -*- coding: utf-
8
-*-
from datetime import
datetime
from datetime import
date
from time import
strftime
from time import
strptime
from datetime import
timedelta
def getCurDate():
""
"Return value of the date"
""
return
date(datetime.now().year,datetime.now().month,datetime.now().day)
def getCurTime():
""
"Return value of the datetime"
""
return
datetime.now()
def converDateTimeToStr(cdate,format='%Y-%m-%d %H:%M:%S'
):
""
"
Convert datetime to String
cdata parameter must be the datetime or date of
Return value of the date string format(%Y-%m-%d)
""
"
sdate = None
try
:
sdate = cdate.strftime(format)
except:
raise ValueError
return
sdate
def converDateToDateTime(fdate):
""
"
&
相关文档:
Python中函数参数的传递是通过“赋值”来传递的。但这条规则只回答了函数参数传递的“战略问题”,并没有回答“战术问题”,也就说没有回答怎么赋值的问题。函数参数的使用可以分为两个方面,一是函数参数如何定义,二是函数在调用时的参数如何解析的。而后者又是由前者决定的。函数参数的定 ......
PEP 0263
Defining Python Source Code Encodings
Python will default to ASCII as standard encoding if no other
encoding hints are given.
To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, suc ......
Python是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发展历史,成熟且稳定。Python 具有脚本语言中最丰富和强大的类库,足以支持绝大多数日常应用。它具有简单、易学、免费、开源、可移植性、解释性、面向对象、可扩展性、可嵌入性以及丰富的库等特性, ......
Chapter 1
Python and XML
Python and XML are two very different animals, each with a rich
history. Python is a full-scale programming language that has grown
from scripting world roots in a very organic way, through the vision
and guidance of Python's inventor, Guido van Rossum. Guido continue ......
发信人: TRAD (GFans), 信区: NLP
标 题: 原创:使用python调用计算所分词
发信站: 水木社区 (Mon Nov 23 13:30:46 2009), 站内
代码很简单,但我自己摸索了一下午,发出来共享一下
把这个文件同ICTALAS30.DLL ,DATA文件夹,Configure.xm l放在同一个目录下即可。
python代码
#coding:gb2312
from cty ......