mac address

S

shama.bell

Hello,
I am a newbie and i have problems filling an array with the mac address
read from the command line.

The mac address is FF:FF:FF:FF:FF:FF

options, args = parser.parse_args()
# options.d contains the address
destAddress = options.d

data = array('L', '\0' * 24)
The array should contain the data as follows:
data[0] = 0xFF
data[1] = 0xFF
.........
data[5] = 0xFF
Any help is appreciated
-SB
 
J

John Machin

Hello,
I am a newbie and i have problems filling an array with the mac address
read from the command line.

The mac address is FF:FF:FF:FF:FF:FF

options, args = parser.parse_args()
# options.d contains the address
destAddress = options.d

data = array('L', '\0' * 24)
The array should contain the data as follows:
data[0] = 0xFF
data[1] = 0xFF
........
data[5] = 0xFF
Any help is appreciated
-SB

You will be better off in the long run if you try to solve these minor
questions yourself.

Break the problem down:

First step: *split* the destAddress into 6 strings
Second step: convert the strings to *long* integer, remembering to use
base 16 arithmetic
Third step: use the resulting 6-element list when creating "data".

Why do you think you need array.array('L', ....)? What are you going to
do with "data" after filling it with the address?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,240
Messages
2,571,205
Members
47,844
Latest member
ChanceGris

Latest Threads

Top