What is the use of filecmp module in Python
Editor to share with you what is the use of the filecmp module in Python, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Description
1. Filecmp is a built-in module in python that compares the contents of files and folders.
2. There are two ways: filecmp.cmp compares the contents of two files to see if they match, and filecmp.cmpfile compares whether the specified files within the two files are equal.
Example
Import filecmp "" description: text.txt and text1.txt content are different, text.txt and text2.txt content are the same. "" Res1 = filecmp.cmp ("text.txt", "text1.txt", shallow=True) print ("comparison between text.txt and text1.txt: {}" .format (res1)) res2 = filecmp.cmp ("text.txt", "text2.txt", shallow=True) print ("comparison between text.txt and text2.txt: {}" .format (res2)) above are all the contents of this article entitled "what is the use of filecmp modules in Python?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!