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):
""
"
&
相关文档:
为了google的google appengine而学习python
发现他真的不如c语言好学,倒不是他难懂,而是相关文档太少,而且不规范。
也许是我的问题吧,我还是喜欢c语言的头文件,还有msdn的那种帮助。一眼就知道使用方法。
说c语言难学,可能是因为没有仔细看这两个东西吧 ......
Alex. J. Champandard
赖勇浩(http://laiyonghao.com) 译
原文地址:http://aigamedev.com/open/interviews/inside-galcon-python-ai/
AiGameDev.com在这个周一的 pratical insights 是对Phil Hassey采访。Phil 是一个独立游戏开发者,也是游戏产业社区的活跃分子。他曾赢得2006年4月的 Ludum Dare 比赛(这个比赛关注 ......
一般安装的都是Python22版,wincvs1.3需要python2.1版本及以上。但是启动过程找不到,网上搜索的方法不大适用。最后经过试验发现,把Python22安装路径下的python22.dll拷贝到wincvs的安装目录下。运行wincvs,ok。觉得这个方法好用的给顶下! ......
http://www.itzn.cn/html/jiaoben/python-perl-VBA/200812/19-3283.html
字符串是使用静态的方式进行存储,只能读而不能直接修改字符内容。特别将一堆对字符串并在一起的时候,虽然可以直接相加,听说这样的速度奇慢,只有用其它函数的方式进行,好在也不太麻烦。
比如用 print ','.join(datelist)
就可以将date ......