Write a Python script to compare two text files line by line

Write in Python a script that takes as an input the paths to two text files. If no inputs are provided, the script processes [url removed, login to view] and [url removed, login to view] from its directory.

The two input files are text files, with either Windows or Unix line feed format, saved either as ascii or as UTF-8 w/o BOM.

The script must analyze the input files on line-by-line basis and produce an [url removed, login to view] file to its directory, that contains the analysis results.

All lines that do not contain a backslash character ("\") are to be ignored and not analyzed in any way. All lines are to be analyzed without case sensitivity.

The script is looking for file or directory names in each line. They are in Windows format (i.e. they use a backslash character) and may not contain a drive letter. Each line can contain between 0 and 5 directory names.

The script analyzes the input files in a way it detects which lines of List1 contain directories that are not present in any line of List2, and vice versa.

The directory comparison must work in a way that only the two top elements of the directories are compared against each other and without case sensitivity. In other words, directories "c:\program files\foobar\[url removed, login to view]" and "d:\foobar\[url removed, login to view]" would be considered a match (because top elements \foobar\[url removed, login to view]" == "\foobar\[url removed, login to view]").

If a line contains more than one directory name, for it to be considered a match with any other line in the other list, the other list must contain the same directories.

For sample data [url removed, login to view] and [url removed, login to view], as well as the desired generated [url removed, login to view] for this sample data, please see the attached zip.

The script must be coded for easy readability so it can be understood by people who are not very familiar with Python. Each major step of operations in the source code must be commented to explain what is happening in the script. The script itself does not need to produce any output to screen, except for an error message if no input data is found.

Taidot: Delphi, Java, Perl, Python, Ruby

Näytä lisää: write simple script python, python script copy paste text files, write shell script compare files, python script parse text files, vb script compare text files store difference text file, perl script compare text files, source script merge text files, compare text files matches, vbs script merge text files, excel script generate text files cells, javascript write text files, compare text files perl match, perl script line match text files, create bulk text files script, python script text files

Tietoa työnantajasta:
( 591 arvostelua ) Turku, Thailand

Projektin tunnus: #11522182

Myönnetty käyttäjälle:


Hello, maybe I am not expert in python, but I have some knowledge of python and I have completed 40+ projects. Also, not expert knowledge may help to write code, that can be understood by people who are not very famili Lisää

$26 USD 2 päivässä
(584 Arvostelua)

2 freelanceria on tarjonnut keskimäärin 23$ tähän työhön


Hello , We would like work with [login to view URL] can do any type of, Software Development ( JAVA,C# ),My SQL , website Design( wordpress ,PHP), Excel, ( vb ,(macro)), Data Entry, Graphic Design, Logo Design .We are fresh freel Lisää

$50 USD 2 päivässä
(0 arvostelua)

Delivery assured within 6 hours.

$20 USD 1 päivässä
(0 arvostelua)