I have a shell command(I'm running it on python) and I want to get its output and store it in a variable. Can you guys help me on how this can be done?
This is my python code...
os.system("unzip -p'" +filepath+"' docProps/app.xml | grep -oP '(?<=\<Pages\>).*(?=\</Pages\>)'"
By the way what it does is it gets the number of page/s of a docx file. It's working but as I've said I don't know how to store it in a variable.
When I do this:
page_number = os.system("unzip -p'" +filepath+"' docProps/app.xml | grep -oP '(?<=\<Pages\>).*(?=\</Pages\>)'"
It doesn't return the right value.
Thank you so much in advance. I tried converting this to a sub-process.call but I also don't know how because I'm a beginner. Thanks again!