11.07.2015 Views

DDM 8.0 Advanced Student Guide

DDM 8.0 Advanced Student Guide

DDM 8.0 Advanced Student Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PART 5: ANSWERS TO EXERCISESPart 1 AnswersFinds Major , minor, update version numbers from the ver command:HP CONFIDENTIAL - ENABLEMENT ONLY, NOT FOR CUSTOMER USE.\[Version\s(\d)\.(\d)\.(\d{4})Gets the Lease obtained and the lease expired from ipconfig /all command:Obtained.+?:\s(.+)Expires.+?:\s(.+)Gets the processor information from the Systeminfo commandProcessor\(\s\):^*(\d*).*\n\s*(.*)Processor\(.\):\s*(\d*).*\s*(\[.*]*)Processor\(s\):\s*(.*)\n\s*(.*)Part 2 Answersimport reimport osfilename = "c:/test.dat"# Create a file object:# in "write" modeFILE = open(filename,"w")# Run the os command systeminfo and send the output to the file#buffer = os.popen("systeminfo")## Write the buffer to the file and close the file#FILE.writelines(buffer)FILE.close()# Open the file for readFILE = open (filename,"r")HP Global Enablement© Copyright 2009 Hewlett-Packard Development Company, L.P. 46

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!