mardi 28 avril 2015

how to parse a particular output like in rows as the output comes in a clubbed way in python?

when i run the below code the ouptut comes as such. I need the output to show in rows AND only the values under the caption.

Desired output:

caption : 3PAR
          3PAR

Actual output:

('Caption                          DeviceID             Model                            Partitions  Size         \r\r\n3PARdata VV SCSI Disk Device     \\\\.\\PHYSICALDRIVE19  3PARdata VV SCSI Disk Device     0           1069286400   \r\r\nHP P2000 G3 FC SCSI Disk Device  \\\\.\\PHYSICALDRIVE1   HP P2000 G3 FC SCSI Disk Device  1           49993251840  \r\r\nHP HSV360 SCSI Disk Device       \\\\.\\PHYSICALDRIVE7   HP HSV360 SCSI Disk Device       4           1069286400   \r\r\nHP HSV360 SCSI Disk Device       \\\\.\\PHYSICALDRIVE27  HP HSV360 SCSI Disk Device       0           1069286400   \r\r\nHP HSV360 SCSI Disk Device       \\\\.\\PHYSICALDRIVE5   HP HSV360 SCSI Disk Device       0           1069286400   \r\r\nHP P2000 G3 FC SCSI Disk Device  \\\\.\\PHYSICALDRIVE23  HP P2000 G3 FC SCSI Disk Device  1           49993251840  \r\r\n3PARdata VV SCSI Disk Device     \\\\.\\PHYSICALDRIVE13  3PARdata 

Code:

p5=subprocess.Popen("rsh -l Administrator 10.10.11.37 \"wmic diskdrive list brief\"",stdout=subprocess.PIPE, shell=True)


result = p5.communicate()
status = p5.wait()
print(result),

Aucun commentaire:

Enregistrer un commentaire