Python Forum
Can python be used to search a word document for combinations of 6 digits? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Can python be used to search a word document for combinations of 6 digits? (/thread-14124.html)



Can python be used to search a word document for combinations of 6 digits? - gkirt1053 - Nov-15-2018

Good morning, sorry I am new to python, but I think it could help me with a problem. I have a word/notepad document that I need to search for 6 digit combinations that already exist in the document. Does anyone know if you can use python for this and if so does anyone have an example script I could use/copy/modify?

thank you,

gk


RE: Can python be used to search a word document for combinations of 6 digits? - ichabod801 - Nov-15-2018

It can certainly be done. The best way to do it would be to save it as a plain text document, read the document in and use the re module's findall to do a regular expression search for the regex '\d\d\d\d\d\d'.


RE: Can python be used to search a word document for combinations of 6 digits? - gkirt1053 - Nov-15-2018

thank you!

gk