posting the code - further to odd problem

Dave Harrison dlharris at mail.usyd.edu.au
Sat Dec 29 03:33:48 EST 2001


Further to my last post I had checked the id of each object and they were unique objects so Im still stuck :-)

However the packet class code is as follows :

import string
pdic = {}
        
class Packet:
	def __init__(self, info):
		self.buildDic(info)
				        
	def buildDic(self, info):
		for item in info:
			split = string.split(item,"=")
			if (len(split) > 1):
				pdic[split[0]] = split[1]
																        
	def getVal(self, key):
		if pdic.has_key(key):
			result = pdic[key]
		else:
			result = ''
		return result

	def getDic(self):
		return pdic

	def printDic(self):
		for item in pdic:
			print item + ':' + pdic[item]




More information about the Python-list mailing list