Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Traceback (most recent call last):
- File "test.py", line 20, in <module>
- mod_f.write(','.join(line) + 'n')
- TypeError: sequence item 3: expected string, float found
- mod_f = open("mod_c_vol_size.txt", 'w')
- mod_f.write("Vserver,Volume,Aggregate,Total,Avail,Node,SaveA,SaveD,SaveC,Snap,Tusedn")
- unit = ['TB', 'GB', 'MB', 'KB', 'B']
- with open("find_c_vol_modify.txt", "r") as f:
- next(f)
- for line in f:
- if len(line.strip()) != 0:
- line = line.split(',')
- out = []
- for l in line[3:5] + line[6:11]:
- l = l.replace('n','')
- try:
- ind = [unit[i] in l for i in range(5)].index(True)
- except ValueError:
- print('please check script')
- val = str(l.split(unit[ind])[0])
- out.append(float(val)/1024**ind)
- line = line[0:3] + out[:-5] + line[5:6] + out[2:]
- print (line)
- mod_f.write(','.join(line) + 'n')
- mod_f.close()
- Vserver,Volume,Aggregate,Total,Avail,Node,SaveA,SaveD,SaveC,Snap,Tused
- XXXX,YYYY,Node1_aggr1,1TB,1023GB,FAS8040-ZZZZ,0B,0B,0B,0B,177.7MB
- XXXX,ZZZZ,Node1_aggr1,3TB,3.00TB,FAS8040-ZZZZ,0B,0B,0B,0B,1.60GB
- XXXX,CCCC,Node1_aggr1,1TB,907.9GB,FAS8040-ZZZZ,0B,0B,0B,0B,116.1GB
- XXXX,VVVV,Node1_aggr1,200GB,200.0GB,FAS8040-ZZZZ,0B,0B,0B,0B,6.25MB
- ['XXXX', 'YYYY', 'Node1_aggr1', 1.0, 0.9990234375, 'FAS8040-ZZZZ', 0.0, 0.0, 0.0, 0.0, 0.00016946792602539061]
- ['XXXX', 'ZZZZ', 'Node1_aggr1', 3.0, 3.0, 'FAS8040-ZZZZ', 0.0, 0.0, 0.0, 0.0, 0.0015625]
- ['XXXX', 'CCCC', 'Node1_aggr1', 1.0, 0.88662109375, 'FAS8040-ZZZZ', 0.0, 0.0, 0.0, 0.0, 0.11337890625]
- ['XXXX', 'VVVV', 'Node1_aggr1', 0.1953125, 0.1953125, 'FAS8040-ZZZZ', 0.0, 0.0, 0.0, 0.0, 5.9604644775390625e-06]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement