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.
Details
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 Test Cases
| Sample Input File | Sample Output File |
|---|---|
1
twenty
42
3rd
1.25
2501
2.4e+32
|
1 42 2501 |
Submission
Submit your program as a .py file on the course Inquire page before class on Wednesday November 12th.