Read Output From A Python Executed Script
I am currently creating a program to extract file from drives. I would like to ask how I read an output that is displayed using python shell? For example: while i
Solution 1:
I do not know how you can capture the output of print os.path.join(root, file)
, but you could also save the output of the call to os.path.join(root,file)
in a variable before printing. Then you can use this variable to call your command. E.g:
while i<len(drives):
print 'Searching for file in:', drives[i]
print ''
for root, dirs, files in os.walk(drives[i]):
for file in files:
if file.endswith(".vmdk") or file.endswith(".vbox"):
filePath = os.path.join(root, file)
print filePath
// call your command here using 'filePath'
i+=1
Post a Comment for "Read Output From A Python Executed Script"