ÓÃ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£¬µ«ÊǸտªÊ¼µÄhelloworld¶¼Ã»·¨´òÓ¡£¬ÈÃÎÒºÜÎÞÄΡ£
ÎÒµÄpython°²×°Â·¾¶Îªf:\python31¡£ÔÚpathÖÐÒ²ÉèÖöÔÁË£¬ÔÚwindowsÏÂÔËÐÐÊÇÕâÑùÏÔʾµÄ£¬Ï£Íû¸÷λǰ±²Ö¸µãһϡ£Ð»Ð»
Pyth ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
map£¬filter·½·¨Ó¦¸Ã»á·µ»ØÒ»¸öÁÐ±í¡£
µ«ÊÇÔÚÎÒÕâÀËüÃÇ×ÜÊÇ·µ»Ø£º
<map object at 0x0000000002A2C978>
<filter object at 0x0000000002A2C9E8>
ÎÒÓõÄpython3.1£¬ Õâ¸öÒ²ÊÇ°æ±¾µÄ±ä¶¯µ¼ÖµÄÂ𣿠......
ѧϰPyQt£¬·¢ÏÖÆäÖÐÒ»¶Î½Å±¾ÊÇÕâÑùµÄ£º
class Form(QDialog):
........
amountLabel = QLabel("Amount")
self.amountLabel = QLabel()
........
pythonÖеÄÀàÖ ......