ÓÃ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 ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
ËÍÆ¼öÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ãæ£¬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
C++Öе÷ÓÃpythonº¯Êý£¬·¢ÏÖpythonº¯ÊýµÄÒì³£ÔÚC++ÖÐÎÞ·¨²¶»ñ¡£
µ÷Óú¯ÊýÈçÏ£¬Çë´óÏÀ½â»ó
unsigned long CPythonHelper::Execute(const std::string& mml_cmd,
u ......
×î½üÒ»¸öÏîÄ¿ÂíÉϾÍÒªÓÃPython±àÁË ´ó¼ÒÍÆ¼ö¸öIDE¡£¡£¡£
1 Ãâ·Ñ¡£¡£¡£
2 Ìå»ý×îºÃСһµã
3 ¹¦ÄÜÇ¿´ó
£¨ÅÅÃû²»·ÖÏȺ󡣡£¡£·Ï»°¡£¡££©
emacs,×î´óµÄÓŵãÊÇÒòΪ·ÇͼÐνçÃæ£¬ÓÃSSHÔ¶³ÌµÇ¼Ҳ¿ÉÒÔʹÓá£ËùÒÔ¿ÉÒÔÓ ......
ѧϰPyQt£¬·¢ÏÖÆäÖÐÒ»¶Î½Å±¾ÊÇÕâÑùµÄ£º
class Form(QDialog):
........
amountLabel = QLabel("Amount")
self.amountLabel = QLabel()
........
pythonÖеÄÀàÖ ......