Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.
Using file I/O we can create programs with simple databases. Databases created by people often have mistakes in them. Before user-created databases can be used by a program, all erroneous data must be removed. In this activity you will demonstrate your knowledge of file I/O by stripping invalid data form a file.
Write a function called file_strip(input_file_name,
output_file_name)
. The
parameters input_file_name
and output_file_name
are both strings that represent
text files. The function should read the contents
of input_file_name
and write a new text file
called output_file_name
that is the same as the input
file but with all lines that don't represent integers removed.
Consider any line that consists of entirely digit characters as a
line that represents an integer.
Make sure your program handles all necessary cases gracefully. What additional test cases should you check?
Sample Input File | Sample Output File |
---|---|
1 twenty 42 3rd 1.25 2501 2.4e+32 |
1 42 2501 |
Submissions for post labs are to be done via the inquire system. Go to http://inquire.roanoke.edu/ You should see a section for post labs. Submit your .py file to the appropriate post lab location.
Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.