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 ) ......
ĿǰΪֹ£¬¾ÝÎÒËùÖª£¬ÔÚpythonÖжÔÏó³Ö¾Ã»¯ÓÐÒÔϼ¸ÖÖ·½·¨£º
1. ʹÓÃ(dbhash/bsddb, dbm, gdbm, dumbdbm µÈ£©ÒÔ¼°ËüÃǵÄ"¹ÜÀíÆ÷"( anydbm )¡£Ö»ÌṩÁË Python ×Ö
·û´®µÄÓÀ¾ÃÐÔ´¢´æ. Ìṩһ¸öÀàËÆ×ÖµäºÍÎļþµÄ¶ÔÏ󣬿ÉÒÔÍê³É×Ö·û´®µÄÓÀ¾ÃÐÔ´æ´¢¡£
2. ʹÓÃmarshalºÍpickleÀ´ÐòÁл¯python¶ÔÏ󣬲¢¾ß±¸´æ´¢µ½½éÖÊÉϵĹ ......
ÓÉsubprocess´´½¨Ò»¸ö½ø³Ì£¬È»ºó½øÐмàÊÓ
ÿһÃëÖӲ鿴һ´Î£¬Èç¹ûÕýÔÚÔËÐУ¬´òÓ¡pidºÍrunning£¬Èç¹ûÒÑÍ£Ö¹£¬,¼ÌÐøÖ´ÐÐÈÎÎñ²¢´òÓ¡Termined
shellºÍstdout¾ùÉèÖÃΪFalse
Ò²ÐíÕâ¶Ô×ö²¡¶¾µÄÊØ»¤½ø³ÌºÜºÃ
#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], she ......
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 ......