passing lists

Kent Johnson kent37 at tds.net
Thu Mar 3 08:53:25 EST 2005


Earl Eiland wrote:
> This message contains the responses to two previous messages:
> 
> In response to Steven B.,the statements
> 	Raw_packet_queue = enqueue(..., Raw_packet_queue, ...)	
> 	print 'Sort 1 Raw_packet_queue is', Raw_packet_queue
> produce the output
> Sort 1 Raw_packet_queue is [[(<Pkthdr object at 0x4341d7d0>,
> '\x00\x00\xd1\xf0\x
> 15\xe1\x00\x051\x0bh\x00\x08\x00E\x00\x004\x96\xc2@\x007\x06\xfc\xff\x89N\xa2j\x
> 81\x8a\x02\xbf\xb1\x13\x00\x16\xe5/\xd5\xa7vu\x0e\x08\x80\x10\xf8\xe0\x8a[\x00\x
> 00\x01\x01\x08\n\x15\xb7\x13\xba\x8e\x91\x9a\xfd'), ['E\x00\x004',
> '@\x00', '\x0
> 6',
> '\x89N\xa2j\x81\x8a\x02\xbf\xb1\x13\x00\x16\xe5/\xd5\xa7vu\x0e\x08\x80\x10\x
> f8\xe0\x8a[\x00\x00\x01\x01\x08\n\x15\xb7\x13\xba\x8e\x91\x9a\xfd']]]
> 
> This consists of two lists [[pcap packet header, pcap packet body], [a
> list of selected IP header fields]].  Raw_packet_queue[0][0][1] should
> return the 'pcap packet body' list element.

No, Raw_packet_queue[0] is [pcap packet header, pcap packet body] so Raw_packet_queue[0][1] is pcap 
packet body. Raw_packet_queue[0][0][1] is (pcap packet header)[1] which doesn't work.

Kent



More information about the Python-list mailing list