I'm pretty new to Python,i am trying to use this code. Everything works if I have to convert a file with a few lines, but if I do it with files of 500 MB it crashes.
import re
import num2words
with open('num.txt') as f_input:
text = f_input.read()
text = re.sub(r"(\d+)", lambda x : num2words.num2words(int(x.group(0))), text)
with open('word.txt','w') as f_output:
f_output.write(text)
What can I do to make it go further than this? is it a memory problem and line reading?