2014-02-23 5 views

답변

0

os 모듈은 매우 유용합니다. 필자는 스크립트 예제를 제공 할 것입니다.

import os,platform,time 
info=os.uname() 
result={'OS':info[0],'Network id':info[1],'Release':info[2],'Os Name':''.join(list(info[3].split()[0])[4:]),'Machine Type':info[4],'System Bit':platform.architecture()[0],'System Linkage':platform.architecture()[1]} 
w = open("rapport.rpt", "w") 
for key, val in result.items(): 
    w.writelines([key,' : ',val,'\n','*'*3,"*"*len(key),'*'*len(val),'\n']) 
w.writelines([time.ctime(),'!']) 
print ('Exporting......') 
time.sleep(1.5) 
w.close() 
print ('operation Finished!',w.name) 
관련 문제