라벨이 filecmp인 게시물 표시

파이썬[Python]: filecmp - cmp 함수

filecmp 모듈 - cmp 함수(function) /// 설명 두 파일을 비교합니다. 같으면 True, 그렇지 않으면 False 를 반환합니다. shallow 인자가 True 이고, os.stat() 시그너쳐(파일타입, 크기, 수정한 날짜)가 같으면 같은 파일로 여깁니다. 그렇지않고 크기와 내용이 다르면 다른 파일로 간주됩니다. ※ 형식 filecmp.cmp(f1, f2, shallow=True) reference https://docs.python.org/3/library/filecmp.html#module-filecmp /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import  filecmp   # __init__1.py and __init__2.txt '' ' import kivy kivy.require(' 2. 0. 0 ') from kivy.app import App from kivy.core.window import Window from kivy.uix.settings import Settings from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.label import Label ' ''     # sizes or contents print (filecmp.cmp( './__init__1.py' ,  './__init__2.txt' , shallow = False ))   # True   # os.stat() signatures (file type, size, and modification time) ---> I expected 'False' print (filecmp.cmp( './__init__1.py' ,  &