Thread: Data Files
View Single Post
  #7  
Old 05-04-2006, 02:43 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

After you open the file, check if it is empty. If it is then write the headings.
Code:
data = open('test.data','a')

#Seek to end of file
data.seek(0,2)
if data.tell() == 0:
	#File is empty, write heading
	data.write('Column 1\tColumn 2\tColumn 3\n')

data.write('some data')
Reply With Quote