Main.Lab7 History

Hide minor edits - Show changes to markup

March 01, 2010, at 01:07 PM MST by 129.82.18.148 -
Changed lines 7-8 from:

Write a function replace(input_file, output_file, s) that replaces all occurrences of the string s in the input file, and writes the resulting file into the file called output_file. Make your program runnable as a script from the command line as python replace_in_file.py input_file output_file s. To do so make use of the array sys.argv (note that you will need to import the sys module before using sys.argv). This list contains the command-line arguments that were used in order to execute the script. The first element in the list is the file name in which the program resides, and the rest of the elements are the command-line arguments that were given by the user.

to:

Write a function replace(input_file, output_file, s, r) that replaces all occurrences of the string s in the input file with the string r, and writes the resulting file into the file called output_file. Make your program runnable as a script from the command line as python replace_in_file.py input_file output_file s r. To do so make use of the array sys.argv (note that you will need to import the sys module before using sys.argv). This list contains the command-line arguments that were used in order to execute the script. The first element in the list is the file name in which the program resides, and the rest of the elements are the command-line arguments that were given by the user.

February 28, 2010, at 07:02 PM MST by 71.196.160.210 -
Changed line 8 from:

Make your program runnable as a script from the command line as python replace_in_file.py input_file output_file s. To do so make use of the array sys.argv. This list contains the command-line arguments that were used in order to execute the script. The first element in the list is the file name in which the program resides, and the rest of the elements are the command-line arguments that were given by the user.

to:

Make your program runnable as a script from the command line as python replace_in_file.py input_file output_file s. To do so make use of the array sys.argv (note that you will need to import the sys module before using sys.argv). This list contains the command-line arguments that were used in order to execute the script. The first element in the list is the file name in which the program resides, and the rest of the elements are the command-line arguments that were given by the user.

February 28, 2010, at 07:01 PM MST by 71.196.160.210 -
Changed lines 3-4 from:

Objectives: more practice with lists and files

to:

Objectives: more practice with lists and files, command-line arguments

Changed lines 8-9 from:
to:

Make your program runnable as a script from the command line as python replace_in_file.py input_file output_file s. To do so make use of the array sys.argv. This list contains the command-line arguments that were used in order to execute the script. The first element in the list is the file name in which the program resides, and the rest of the elements are the command-line arguments that were given by the user.

Changed line 12 from:

Write a function merge(list1, list2) that receives two sorted lists as input and merges. It should return the merged list.

to:

Write a function merge(list1, list2) that receives two sorted lists as input and merges them. It should return the merged list.

February 28, 2010, at 01:10 PM MST by 71.196.160.210 -
Added lines 1-11:

Lab 6

Objectives: more practice with lists and files

Replace in a file

Write a function replace(input_file, output_file, s) that replaces all occurrences of the string s in the input file, and writes the resulting file into the file called output_file.

List merging

Write a function merge(list1, list2) that receives two sorted lists as input and merges. It should return the merged list.