I got a string looking like that:
EVENTS: RAID
Volume Set Information
Volume Set Name : ARC-1120-VOL#00
Raid Set Name : Raid Set # 00
Volume Capacity : 1.0GB
SCSI Ch/Id/Lun : 00/00/00
Raid Level : Raid5
Stripe Size : 64K
Member Disks : 3
Cache Mode : Write Back
Tagged Queuing : Enabled
Volume State : Degraded
Volume Set Information
Volume Set Name : ARC-1120-VOL#01
Raid Set Name : Raid Set # 00
Volume Capacity : 5.0GB
SCSI Ch/Id/Lun : 00/00/01
Raid Level : Raid5
Stripe Size : 64K
Member Disks : 3
Cache Mode : Write Back
Tagged Queuing : Enabled
Volume State : Degraded
And when I done a string.strip("EVENTS: RAID\n"), i got this result:
olume Set Information
Volume Set Name : ARC-1120-VOL#00
Raid Set Name : Raid Set # 00
Volume Capacity : 1.0GB
SCSI Ch/Id/Lun : 00/00/00
Raid Level : Raid5
Stripe Size : 64K
Member Disks : 3
Cache Mode : Write Back
Tagged Queuing : Enabled
Volume State : Degraded
Volume Set Information
Volume Set Name : ARC-1120-VOL#01
Raid Set Name : Raid Set # 00
Volume Capacity : 5.0GB
SCSI Ch/Id/Lun : 00/00/01
Raid Level : Raid5
Stripe Size : 64K
Member Disks : 3
Cache Mode : Write Back
Tagged Queuing : Enabled
Volume State : Degraded
Question: Why the V of "Volume Set Information" is disappeared ?
As you can see, I want to remove the first line, if anybody know a better way to do? (I know there is a lot of "pythonic" guys here... give me your best shot =)
Did you read the documentation of strip()
?
It strips of any number of characters that you provided, so .strip("EVENTS: RAID\n")
strips of every E
, every V
, every E
, every N
, ... until one character is found that's not in there! This is why the V
of Volume Set Information
goes missing.
Try replace(string, "EVENTS: RAID\n", "", 1)
instead.