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

ÓÃpython½øÐÐÎļþ±È½ÏµÄÎÊÌâ

ÔÚPython for unix and linux System AdministrationÕâ±¾ÊéµÄµÚ6ÕµÄComparing DataÒ»½ÚÌáµ½ÓÃfilecmpÕâ¸öÄ£¿éµÄcmpº¯ÊýÀ´ÅжÏ2¸öÎļþÊÇ·ñÏàͬ¡£

ÈçÏÂËùʾ£º
Python code:

import filecmp
filecmp.cmp('file1.txt','file2.txt')


Èç¹û2¸öÎļþÄÚÈÝÏàͬ£¬Ôò·µ»ØTrue £¬·ñÔò·µ»ØFalse

±¾À´¿´µ½Õâ¾õµÃ¶¼Ã÷°×ÁË£¬ÓÖ¿´µ½ÕâÑùÒ»¾ä»°£º
The filecmp module contains functions for doing fast and efficient comparisons of files
and directories. The filecmp module will perform a os.stat on two files and return a
True if the results of os.stat are the same for both files or a False if the results are not.
Typically, os.stat is used to determine whether or not two files use the same inodes
on a disk and whether they are the same size, but it does not actually compare the
contents.
ÕâÀï˵filecmp.cmpÊÇͨ¹ýµ÷ÓÃ2¸ö·½·¨µÄos.stat()·µ»Ø½á¹û£¨ÊÇ·ñʹÓÃÁË´ÅÅÌÉϵÄÏàͬ½Úµã¡¢Îļþ´óСÊÇ·ñÏàµÈ)À´ÅжÏÎļþÊÇ·ñÏàͬ£¬Êµ¼ÊÉϲ¢Ã»¶ÔÎļþÄÚÈݽøÐбȽϡ£ÎÒÕâÀïºÜ²»Ã÷°×£¬²»ÖªµÀÕâÑù×öµÄÔ­ÀíÊÇʲô£¿

ÁíÍâÔÙÎÊÒ»¾ä£¬¿ÉÒÔÓÃMD5УÑéºÍÀ´ÅжÏÎļþÊÇ·ñÍêÈ«ÏàͬÂð£¬Èç¹û¿ÉÒÔ£¬Ò»°ãÊÊÓÃÓÚʲô³¡ºÏ¡£ºÍÉÏÃæµÄ·½·¨Ïà±ÈÓÐʲôÓÅȱµã£¿


inode ½á¹¹ºÍÏà¹ØÁªµÄ²Ù×÷


»¹ÊDz»Ì«Ã÷°×inodeºÍÎļþÄÚÈݵĹØϵ£¬ÎªÊ²Ã´¿ÉÒÔÖ»ÅжÏinodeÄØ£¿
ÓÐûÓпÉÄÜinodeÏàͬµ«ÎļþÄÚÈݲ»Í¬£¬»òÕßÎļþÄÚÈÝÏàͬµ«inode²»Í¬£¿
Âé·³DarkCh


Ïà¹ØÎÊ´ð£º

PythonÖеÄUnicodeÔÚDelphiÈçºÎ»¹Ô­³ÉGb2312£¿

ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ

ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô­³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......

IIS 7 python 2.6 cgi ÎļþÉÏ´«ÎÊÌâ

ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......

python listÖÐÌí¼ÓÀà¶ÔÏóµÄÎÊÌâ

ÔÚlistÖÐÌí¼ÓÒ»¸öÀàµÄ¾Ö²¿±äÁ¿ ÕâÑù×öÊÇ·ñºÏ·¨ Çë¿´ÏÂÃæÀý×Ó:
Python code:

class A():
def __init__( self ):
self.__a = 0
self.__b = 'hello'
def get_a( self ):
ret ......

python ÕýÔòÆ¥ÅäÖÐÎÄ

ÔÚÎı¾ÎļþÖÐÆ¥ÅäÏî°üº¬ÖÐÎÄ
ÈçÄÚÈÝΪ£ºgamename=ÖÐÎÄ 
  key=ÌìÏÂ
Îı¾ÎļþµÄ±àÂëµÄÎļþΪutf-8
python´úÂëÈçÏ£º
# -*- coding:UTF-8 -*-
  contents=open(from_pa ......

¾«ÐÄËѼ¯µÄѧϰpythonµÄ7±¾Êé

ѧϰpythonµÄ7±¾Êé
°üÀ¨6±¾chm£¬Ò»±¾pdf×ÊÁÏ
¶ÔѧϰpythonÓкܴóµÄ°ïÖú 
http://download.csdn.net/source/619791
¾«ÐÄËѼ¯£¬²»Òª»ý·Ö£¬ÄóöÀ´·ÖÏí
лл¥Ö÷£¬ÐÁ¿àÁË~



lz ×îºÃ°ÑÊéÃûºÍ¼òµ¥½éÉܼÓÉ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ