summaryrefslogtreecommitdiffstats
path: root/For Weekly Test/30-07-2011/DeviceAddress.py
blob: 6f0039d280119748cc6c92aa070d3af0de54ec9e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class DeviceAddress:
	
	def __init__(self):
		self.add = None
		self.num = None

	def findDevice(self, device):
		file = open('DeviceAddress.txt', 'r')

		for line in file:
     
			first = line.find('[')
			second= line.find(']')         # search for position
			find = line[first+1:second]
	
			stop = line.find(':')
			newLine =line[stop+1:]
			stop2 = newLine.find(':')
			
			no = newLine[stop2+1:]
			stop3 = no.find(':')
			
	
			if find == device:
				self.add = newLine[0:stop2]
				self.num = no[0:stop3]
		file.close()