[Tutor] creating files with python and a thanks

kevin parks kp87@lycos.com
Sun, 17 Feb 2002 20:57:36 +0900


>How can you tell Python to make a simple text file or to make a kind of file 
>with your own kind of extension?

I am guessing that you are on a PC, but if on the off chance you are on the Macintosh you can set the creator and type codes and pop the file open with something like this:

def launcher(file_name, cr = 'R*ch', tp = 'TEXT'):
	'''set file type & creator codes and pop the window open in the finder
	
	Macintosh specific
	'''
	cr = 'R*ch'						# set the file type and creator codes
	tp = 'TEXT'						# some types: 'Pyth'  'ttxt' 'R*ch'  'BOBO'  'TBB6'
	fs = macfs.FSSpec(file_name)
	fs.SetCreatorType(cr, tp)
	findertools.launch(file_name)	#  and pop the file open in the finder.
--

-kevin
seoul, korea (yes i am the 1 person in Korea not using a windoze PC)




Check out Cupid School where you will learn from Matchmaker's
best and brightest. Good Luck!

http://ecard.matchmaker.com/cupid0202/cupid0202.html