'python: find numbers in docx file and replace

I want to read the docx file in python. then extract numbers from that like:

with open('test.docx') as t:
    text = t.readlines()
a = []
a.append([int(s) for s in text.split() if s.isdigit()])
a = [int(numeric_string) for numeric_string in a]

Thanks for any bits of help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source