4 """File for data output
5
6 The format of the file is: one data-set per line
7 Values are separated by tabs
8
9 The file is created the first time it is written"""
10
12 """name - name of the file"""
13 self.name=name
14 self.isOpen=False
15 self.handle=None
16
18 """A hook for outputting stuff at the beginning of the file"""
19 pass
20
22 """A hook for outputting stuff at the end of the file"""
23 pass
24
26 """A hook for outputting stuff at the end of each line"""
27 pass
28
30 """A hook for outputting stuff at the start of each line"""
31 pass
32
34 """get the file-handle. File is created and opened if it
35 wasn't opened before"""
36 if not self.isOpen:
37 self.handle=open(self.name,"w")
38 self.isOpen=True
39 self.outputAtStart()
40
41 return self.handle
42
59
61 """close the file"""
62
63 if self.handle!=None:
64 self.outputAtEnd()
65 self.handle.close()
66 self.handle=None