[Tutor] creating a tab delimited filename
Jacob S.
keridee at jayco.net
Wed Mar 16 01:45:31 CET 2005
> that is exactly what i am looking for, but how would i add this to my
> filename???
> should i use this:
>
> output_file = open(os.path.join(self.Save_Session.GetValue(),
> time.strftime('%Y%m%d%H%M')), 'w')
>
> the self.Save_Session.GetValue() is generated by a dirdialog
>
Uck,uck, uck, no...
That's what Kent's post was for...
This will do the trick.
filename = "%s%s.txt" %
(self.Save_Session.GetValue(),time.strftime("%Y%m%d%H%M"))
output_file = open(filename,"a")
This uses string formatting, are you familiar with that?
If not -- see here http://docs.python.org/lib/typesseq-strings.html#l2h-211
remember, if you don't understand--not that you wouldn't--you can always ask
here.
HTH,
Jacob
More information about the Tutor
mailing list