I have a list of dictionaries whose keys contain spaces.
input = [{'books author': 'bob', 'book title': 'three wolves'},{'books author': 'tim', 'book title': 'three apples'}]
How would I go about iterating over the said list of dictionaries, and replacing the keys' that contain spaces, with underscores, with output being
output = [{'books_author': 'bob', 'book_title': 'three wolves'},{'books_author': 'tim', 'book_title': 'three apples'}]
Note, the actual dictionaries can contain a few hundred keys, and a list will consist of thousands of dict
s.