Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PythonÈÕÆÚ²Ù×÷ѧϰ±Ê¼Ç

 http://www.itzn.cn/html/jiaoben/python-perl-VBA/200812/19-3283.html
×Ö·û´®ÊÇʹÓþ²Ì¬µÄ·½Ê½½øÐд洢£¬Ö»ÄܶÁ¶ø²»ÄÜÖ±½ÓÐÞ¸Ä×Ö·ûÄÚÈÝ¡£Ìرð½«Ò»¶Ñ¶Ô×Ö·û´®²¢ÔÚÒ»ÆðµÄʱºò£¬ËäÈ»¿ÉÒÔÖ±½ÓÏà¼Ó£¬Ìý˵ÕâÑùµÄËÙ¶ÈÆæÂý£¬Ö»ÓÐÓÃÆäËüº¯ÊýµÄ·½Ê½½øÐУ¬ºÃÔÚÒ²²»Ì«Âé·³¡£
±ÈÈçÓà print ','.join(datelist)
¾Í¿ÉÒÔ½«datelistÁбíÀïÃæµÄËùÓÐÏîÄ¿²¢³ÉÒ»¸ö×Ö·û´®£¬µ±È»Õâ¸ö±í´ïʽ»áÔÚÿһ¸öÏîÄ¿Öмä²åÈëÒ»¸ö¶ººÅ£¬ÕâÖÖ·½Ê½±ÈÓÃÑ­»·µÄ·½Ê½¸ü¼ò½à¡£
ÈÕÆÚµÄ²Ù×÷±ØÐëʹÓÃtime»òdatetime¿â
import time
>>> s="2006-1-2"
>>> time.strptime(s,"%Y-%m-%d)
ÕâÊǽ«×Ö·û´®¸ñʽµÄÈÕÆÚ¼°Ê±¼äת³ÉÈÕÆÚ¶ÔÏó
תÒå·û¶ÔÓ¦ÒâÒåÈçÏÂ
%a ±¾µØ¼ò»¯ÐÇÆÚÃû³Æ
%A ±¾µØÍêÕûÐÇÆÚÃû³Æ
%b ±¾µØ¼ò»¯µÄÔ·ÝÃû³Æ
%B ±¾µØÍêÕûµÄÔ·ÝÃû³Æ
%c ±¾µØÏàÓ¦µÄÈÕÆÚ±íʾºÍʱ¼ä±íʾ
%d ÔÂÄÚÖеÄÒ»Ì죨0-31£©
%H 24Ð¡Ê±ÖÆÐ¡Ê±Êý£¨0-23£©
%I 12Ð¡Ê±ÖÆÐ¡Ê±Êý£¨01-12£©
%j ÄêÄÚµÄÒ»Ì죨001-366£©
%m Ô·ݣ¨01-12£©
%M ·ÖÖÓÊý£¨00=59£©
%p ±¾µØA.M.»òP.M.µÄµÈ¼Û·û
%S Ã루00-59£©
%U Ò»ÄêÖеÄÐÇÆÚÊý£¨00-53£©ÐÇÆÚÌìΪÐÇÆÚµÄ¿ªÊ¼
%w ÐÇÆÚ£¨0-6£©£¬ÐÇÆÚÌìΪÐÇÆÚµÄ¿ªÊ¼
%W Ò»ÄêÖеÄÐÇÆÚÊý£¨00-53£©ÐÇÆÚһΪÐÇÆÚµÄ¿ªÊ¼
%x ±¾µØÏàÓ¦µÄÈÕÆÚ±íʾ
%X ±¾µØÏàÓ¦µÄʱ¼ä±íʾ
%y Á½Î»ÊýµÄÄê·Ý±íʾ£¨00-99£©
%Y ËÄλÊýµÄÄê·Ý±íʾ£¨000-9999£©
%Z µ±Ç°Ê±ÇøµÄÃû³Æ
%% %ºÅ±¾Éí
============================================
#-*- coding:utf-8 -*-
import time
import datetime
# 2007-11-25 15:36:35
#ʹÓÃdatetimeÄ£¿é¿ÉÒԺܷ½±ãµÄ½â¾öÕâ¸öÎÊÌ⣬¾ÙÀýÈçÏ£º
d1 = datetime.datetime(2005, 2, 16)
d2 = datetime.datetime(2004, 12, 31)
# ½á¹û:47
print (d1 - d2).days
#ÉÏÀýÑÝʾÁ˼ÆËãÁ½¸öÈÕÆÚÏà²îÌìÊýµÄ¼ÆËã¡£
starttime = datetime.datetime.now()
endtime = datetime.datetime.now()
print (endtime - starttime).seconds
#ÉÏÀýÑÝʾÁ˼ÆËãÔËÐÐʱ¼äµÄÀý×Ó£¬ÒÔÃë½øÐÐÏÔʾ¡£
d1 = datetime.datetime.now()
d3 = d1 + datetime.timedelta(days =10)
print str(d3)
print d3.ctime()
# ÉÏÀýÑÝʾÁ˼ÆË㵱ǰʱ¼äÏòºó10ÌìµÄʱ¼ä¡£
# Èç¹ûÊÇСʱ days »»³É hours
# Æä±¾Éϳ£ÓõÄÀàÓУºdatetimeºÍtimedeltaÁ½¸ö¡£ËüÃÇÖ®¼ä¿ÉÒÔÏ໥¼Ó¼õ¡£
# ÿ¸öÀà¶¼ÓÐһЩ·½·¨ºÍÊôÐÔ¿ÉÒԲ鿴¾ßÌ


Ïà¹ØÎĵµ£º

PEP 0263 Defining Python Source Code Encodings

 
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¼¸ÖÖ²¢·¢ÊµÏÖ·½°¸µÄÐÔÄܱȽÏ

 
#!/Library/Frameworks/Python.framework/Versions/2.5/bin/python
# encoding: utf-8
import sys, time
import thread
 
SLEEP_TIME = 0.0001
 
def run_benchmark(n, m):
    # print(">> Python 2.5.1, stackless 3.1b3 here (N=%d, M=%d)!\n" % (n, m))
    lock ......

eat python 002

 Ä¿Ç°ÎªÖ¹£¬¾ÝÎÒËùÖª£¬ÔÚpythonÖжÔÏó³Ö¾Ã»¯ÓÐÒÔϼ¸ÖÖ·½·¨£º
1. ʹÓÃ(dbhash/bsddb, dbm, gdbm, dumbdbm µÈ£©ÒÔ¼°ËüÃǵÄ"¹ÜÀíÆ÷"( anydbm )¡£Ö»ÌṩÁË Python ×Ö
·û´®µÄÓÀ¾ÃÐÔ´¢´æ. Ìṩһ¸öÀàËÆ×ÖµäºÍÎļþµÄ¶ÔÏ󣬿ÉÒÔÍê³É×Ö·û´®µÄÓÀ¾ÃÐÔ´æ´¢¡£
2. ʹÓÃmarshalºÍpickleÀ´ÐòÁл¯python¶ÔÏ󣬲¢¾ß±¸´æ´¢µ½½éÖÊÉϵĹ ......

eat python 003

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 ......

Eclipse+PyDev = Python±à¼­Æ÷£¬

http://www.ibm.com/developerworks/cn/opensource/os-cn-ecl-pydev/Á¬½ÓÕâ¸öÍøÖ·£¬²»»áÈÃÄãʧÍûµÄ¡£
PyDev ¼ò½é
2003Äê7ÔÂ16ÈÕ£¬ÒÔ Fabio Zadrozny ΪÊ×µÄÈýÈË¿ª·¢Ð¡×éÔÚÈ«Çò×î´óµÄ¿ª·ÅÔ´´úÂëÈí¼þ¿ª·¢Æ½Ì¨ºÍ²Ö¿â SourceForge ÉÏ×¢²áÁËÒ»¿îеÄÏîÄ¿£¬¸ÃÏîĿʵÏÖÁËÒ»¸ö¹¦ÄÜÇ¿´óµÄ Eclipse²å¼þ£¬Óû§¿ÉÒÔÍêÈ«ÀûÓà Eclipse À ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ