⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tapeinfo.py

📁 通用SCSI设备备份/读写程序
💻 PY
字号:
# Copyright 2000 Enhanced Software Technologies Inc.# All Rights Reserved# Released under Free Software Foundation's General Public License,# Version 2 or above# Routine to call 'tapeinfo' and read status for a node. This is an# example of how to parse the 'tapeinfo' output from a scripting language.#import osimport stringimport sysconfigdir="/opt/brupro/bin"  # sigh.def inquiry(device):    retval={}    # okay, now do the thing:    command="%s/tapeinfo -f %s" % (configdir,device)    # Now to read:    infile=os.popen(command,"r")    try:        s=infile.readline()    except:        s=""        pass    if not s:        return None # did not get anything.    while s:        s=string.strip(s)        idx,val=string.split(s,':',1)        val=string.strip(val)        if val[0]=="'":            val=val[1:-1] # strip off single quotes, sigh.            val=string.strip(val)            pass        while "\0" in val:            # zapo!            val=string.replace(val,"\0","")            pass        retval[idx]=val        try:            s=infile.readline()        except:            s=""            pass        continue # to top of loop!    return retval

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -