Search and replace numbers with words in file [duplicate]
问题 This question already has answers here : replacing text in a file with Python (7 answers) Closed 3 years ago . I have a file that contains numbers and letters and I want to replace all the numbers to words (for example, 8 is converted to eight). Well I just don't get a way to check if there is numbers on my file. What is the best effective way to do this? 回答1: The following should work, it reads an input file, uses a regex to find all of the numbers, and the num2words library to replace each