Description
This project is my first on programming career and this project was assigned by my mentor.
The code is purposefully to be used in an application to compare two text files.
The code uses simple programming logic to run, based on my current coding abilites.
Features
- Insert names of two text files (.txt) to compare between;
- The code will run through each line of text and not senteces nor words;
- The different lines between text files will be extracted and shown on the console, included the information which line number is different;
How to use
- Open Python program, copy the code from here and paste it;
- Hit "Run" on Python;
- Enter text files' names, that you already know that they exist. Both files must be placed on the Python directory: "C:\Users\Username\PycharmProjects\Projectname";
- Proceed as per console program requirements;
- Check the results.
Requirements to run the code
- Python ver 3.0 and up.
TODO: Improvements in the future
Add feature: - For file exception, when there is not the appropriate file name found;
- To compare text by words, meaning to find the "only" different words for similar sentences;
- To compare >2 files at same time;
Running the tests
- For testing purpose, download two text files, namely: Textfile1.txt and Textfile2.txt;
- Move to the specified location directory as per "How to use";
- Open Python and run the code
- The results should shown as below:
>+ Line-2 This sentence is only in the file named Testfile1 and should be shown on results, noting that it exists only on this file.
<+ Line-3 This sentence is only in the file named Testfile2 and should be shown on results, noting that it exists only on this file.
> Line-4 This sentence should shown from both files noting only for the difference on word between file Testfile1 and Testfile2.
< Line-4 This sentence should shown from both files noting only for the difference on word between file Testfile2 and Testfile1."