I require a program that will remove all trailing whitespace (any spaces that occur at the end of a line) from a text file. It should do something like:
Enter the name of the file to be stripped: news.txt
Any help would be gladly appreciated.
I'm also seeking help for writing a recursive function search(l,key) that returns a boolean: True if key is in the list l; False if it isn't. The in operator and the index() list method both can't be used. It should report the position of the key, if present. Something like search(l,key) returning the index of key in l, or False, if key is not present.
#- sample main -# l1 = [1, '2', 'x', 5, -2] print search(l1, 'x') # should output: "2" print search(l1, 2) # should output: "False"