Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program diff.py that takes two file names from the command line. The file names may NOT have spaces in them! It then writes

Write a program diff.py that takes two file names from the command line. The file names may NOT have spaces in them! It then writes either files differ or files are the same.

Example: the user may run your program thus:

python diff.py file1.txt file2.txt

Method: open the files, and read their lines. Then compare their lists of lines.

CODE GIVEN:

''' Takes two filenames from the command line, and determines if the files have the same content. '''

import sys

if len(sys.argv) != 3: print('Usage: python diff.py ') sys.exit(1)

file_name1 = sys.argv[1]

# ... write the rest of your code here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Explain what workforce diversity represents.

Answered: 1 week ago