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

python¶ÁȡĿ¼ÏÂÎļþ²¢Éú³ÉÈÕÖ¾

ºÜ³¤µÄÒ»¶Î´úÂ룬µ«ºÜÇå³þ¡£¹þ¹þ¡£
import os
from time import strftime
stamp=strftime("%Y-%m-%d %H:%M:%S")
logfile = 'F:\\test\\m-php-framework\\tmp\logs\\error_report.log'
path = 'F:\\test\\'
files = os.listdir(path)
bytes = 0
numfiles = 0
for f in files:
if f.startswith('t'):
info = os.stat(path + f)
numfiles +=1
bytes+=info[6]
if numfiles > 1:
title = 'tiles'
else:
title = 'file'
string = stamp + " -- " + str(numfiles) + " session" +title+","+ str(bytes)+" bytes\n"
file = open(logfile,"a")
file.writelines(string)
file.close()


Ïà¹ØÎĵµ£º

PythonÓïÑÔ¸ÅÀÀ

python
ÓïÑÔ¸ÅÀÀ
 
python
½Å±¾¿ÉÒÔ´¦ÀíÍⲿ´«½øÀ´µÄ²ÎÊý ¼´sys.argv[] 
£¬argv[]
µÄʹÓÃÓëlinux
ÏÂÏàͬ
python
±¾ÉíÊǽâÊÍÓïÑÔ£¬¿ÉÒÔ¶ÔÊäÈëµÄʽ×ÓÇóÖµ¡£python
Ö§³ÖµÄ¶ÔÏóÈçÕûÊý¶¼ÊÇÁ¢¼´Êý£¬´ËÍâËûÖ§³Ö¸´Êý£¬¼°¶ÔËÄÔòÔËËã½âÊÍ¡£
ptyhon
Ö§³Ö×Ö·û´®£¬·ÅÔÚµ¥/
Ë«ÒýºÅÄÚ£¬×Ö·û´®ÊÇÊý×飬¿ÉÒÔͨ¹ý[i: ......

ÔÚubuntuÉϱàÒëvim²¢´øÓÐpythonÖ§³Ö

ubuntu10.05³öÀ´ÁËÕâÁ½ÌìÒ»Ö±ÔÚÕÛÌÚ£¬ÏÔʾwubiÎÞ·´Ó¦£¬È»ºó´ÓÓ²ÅÌ°²×°ÆÚ¼äÓÖÓöµ½grub´íÎóµÈÎÊÌâ¡£°²×°³É¹¦ºó¸ã¸öÖÐÎÄÊäÈë·¨¾ÍÀÏ°ëÌ죬×îºóʹÓÃPinyinÕâ¸ö»¹ËãºÃÓã¬ÓеãÏëËѹ·¾ÍÊÇûʲô´Ê¿â¡£×î¶ñÐĵĻ¹ÊÇvimµÄÎÊÌ⣬ÓÃapt-get install vim×°µÄvim²»Ö§³Öϵͳ¼ôÇа壬ֻºÃ´ÓÔ´´úÂë±àÒ룬¿ÉÊÇÎÒ³¢ÊÔÁ˺ܶà´Î×ÜÊÇûÓÐpythonÖ§ ......

¹ØÓÚPythonµÄÁбíappend£¨£©·µ»ØNone¶ÔÏó


ÔÚLearning Python 3rd ÀïµÚÈý²¿·ÖÁ·Ï°ÌâÓеÀÌ⣺
1.c ±àдfor Ñ­»·£¬¶ÔÓÚ×Ö·û´®S£¬·µ»ØÒ»¸öеÄÁÐ±í£¬ÆäÖаüº¬ÁË×Ö·û´®Ã¿¸ö×Ö·ûµÄASCIIÂë¡£
ÎÒµÄ˼·ÊÇ£º
for i in S:
    L = [ord(i) for i in S] #Áбí½âÎöµÄ˼·
ÎҵĴíÎó˼·£º
for i in S:
    L = L.append(ord(i))
Ìáʾ¿Õ¶ ......

pythonÖÐ%·ûºÅÏê½â

%a ÐÇÆÚ¼¸µÄ¼òд
%A ÐÇÆÚ¼¸µÄÈ«³Æ
%b Ô·ֵļòд
%B Ô·ݵÄÈ«³Æ
%c ±ê×¼µÄÈÕÆÚµÄʱ¼ä´®
%C
Äê·ÝµÄºóÁ½Î»Êý×Ö
%d Ê®½øÖƱíʾµÄÿÔµĵڼ¸Ìì
%D ÔÂ/Ìì/Äê
%e ÔÚÁ½×Ö·ûÓòÖУ¬Ê®½øÖƱíʾµÄÿÔµĵڼ¸Ìì
%F
Äê-ÔÂ-ÈÕ
%g Äê·ÝµÄºóÁ½Î»Êý×Ö£¬Ê¹ÓûùÓÚÖܵÄÄê
%G Äê·Ö£¬Ê¹ÓûùÓÚÖܵÄÄê
%h ¼òдµÄÔ·ÝÃû ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ