We just start with python and know enough to know that I don't know anything. I would like to find alternative ways to split the list into a list of dicts. List of examples:
data = ['ID:0:0:0',
'Status:Ok',
'Name:PhysicalDisk0:0:0',
'State:Online',
'FailurePredicted:No',
'ID:0:0:1',
'Status:Ok',
'Name:PhysicalDisk0:0:1',
'State:Online',
'FailurePredicted:No']
Ready list of dicts:
[{'Status': 'Ok',
'State': 'Online',
'ID': '0:0:0',
'FailurePredicted': 'No',
'Name': 'PhysicalDisk0:0:0'},
{'Status': 'Ok',
'State': 'Online',
'ID': '0:0:1',
'Name': 'PhysicalDisk0:0:1',
'FailurePredicted': 'No'}]
The list has duplicate elements that require several dicts, and the list changes in length. My code seems like it could be simplified if I only knew Python. My current code is:
REMOTE CODE This did not work. :(
----------- File output as requested -------------------
List of Physical Disks on Controller PERC 5/i Integrated (Embedded)
Controller PERC 5/i Integrated (Embedded)
ID : 0:0:0
Status : Ok
Name : Physical Disk 0:0:0
State : Online
Failure Predicted : No
Progress : Not Applicable
Type : SAS
Capacity : 136.13 GB (146163105792 bytes)
Used RAID Disk Space : 136.13 GB (146163105792 bytes)
Available RAID Disk Space : 0.00 GB (0 bytes)
Hot Spare : No
Vendor ID : DELL
Product ID : ST3146755SS
Revision : T107
Serial No. : 3LN1EF0G
Negotiated Speed : Not Available
Capable Speed : Not Available
Manufacture Day : 07
Manufacture Week : 24
Manufacture Year : 2005
SAS Address : 5000C50004731C35
ID : 0:0:1
Status : Ok
Name : Physical Disk 0:0:1
State : Online
Failure Predicted : No
Progress : Not Applicable
Type : SAS
Capacity : 136.13 GB (146163105792 bytes)
Used RAID Disk Space : 136.13 GB (146163105792 bytes)
Available RAID Disk Space : 0.00 GB (0 bytes)
Hot Spare : No
Vendor ID : DELL
Product ID : ST3146755SS
Revision : T107
Serial No. : 3LN1EF88
Negotiated Speed : Not Available
Capable Speed : Not Available
Manufacture Day : 07
Manufacture Week : 24
Manufacture Year : 2005
SAS Address : 5000C500047320B9
source
share