[EMAIL PROTECTED] wrote: > 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? -- http://mail.python.org/mailman/listinfo/python-list