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):
""
"
&
相关文档:
import Queue, threading, sys
from threading import Thread
import time,urllib
# working thread
class Worker(Thread):
worker_count = 0
def __init__( self, workQueue, resultQueue, timeout = 0, **kwds):
Thread.__init__( self, **kwds ) ......
Documentation for C's fopen():
---
r Open text file for reading. The stream is positioned at the beginning
of the file.
r+ Open for reading and writing. The stream is positioned at the
beginning of the file.
w Truncate file to zero length or create text file for writing. The
stream is posi ......
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 比赛(这个比赛关注 ......
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 ......