import os
import sys
def main():
pass
if __name__ == '__main__':
Job_Status = str(sys.argv[1])
a1 = Job_Status.replace("{", "")
a1 = a1.split(',');print a1;
if a1[5] =='runstatus:null':
print a1[5]
if a1[5] == 'runstatus:203'or a1[5] == 'runstatus:202' or a1[5] == 'runstatus:201' and a1[5] == 'runstatus:null':
print a1[5]
a1 = ['creationclassname:NVBUPhaseStatus', 'runstarttime:null', 'exitstarttime:1516358894', 'nextruntime:null', 'policyname:null', 'runstatus:null', 'exitbytestransferred:1245184', 'averagesize:1245184', 'runstatusmsg:null', 'serviceid:NVBU-HIPUNL61260', 'jobid:63', 'clientname:AB-WIN2K12R2-64', 'exitstatus:300', 'title:job1', 'jobtype:1', 'ackedstatus:null', 'exitstatusmsg:Backup']
Output : runstatus:null
答案 0 :(得分:0)
您可以使用index()
方法在列表中找到字符串的位置:
pos = a1.index('runstatus:null')