I am just learning basic python for myself - and hoping to make some simple ..and I mean simple scripts to do a few repetitive tasks
One of these is zoning WWN for Cisco switches in a SAN
Normally we would need 2 WWNs of 2 ports (ie a host =20:00:00:00:00:00:00:00 + Storgae box =50:06:01:00:00:00:00:00) Once we have that, we make a name and add these WWN to it
zone name **host_Storage**
Adding member: member pwwn 50:06:01:00:00:00:00:00 (ie Storage)
Adding member: member pwwn 20:00:00:00:00:00:00:00 (ie host)
I am at the start and want to get a input of a WWN and if its either one of the 2 WWN numbers
- 2000000000000000
- 20:00:00:00:00:00:00:00
It will always give me the 2nd format,
ie 20:00:00:00:00:00:00:00
I found something that does this here: Inserting a character at regular intervals in a list
But would like to get this working in a script
This works---
s = '10000000c9abcdef'
':'.join(a + b for a, b in zip(*[iter(s)]*2))
'10:00:00:00:c9:ab:cd:ef'
This does not work (when trying to create a type of script) --
wwn = (input('Enter the WWN or q to quit- '))
':'.join(a + b for a, b in zip(*[iter(wwn)]*2))