Creating a file to write in python -


pardon me silly newbie question, create/open file writing compiler error.

    tmp1 = os.path.join(self.vardirname.get(), strftime("%y_%m_%d")+'_errs')     tmp2 = os.path.join(tmp1,mysubfolder)     if not os.path.exists(tmp2):         os.makedirs(tmp2)       fn = os.path.join(tmp2,'hello.txt')     f = file(fn, "w")      #i tried this:     fna = os.path.join(tmp2,'hello.txt')     fn = "hello.txt"     f = open(fn, "w") 

error in last line: nameerror: name 'fn' not defined, if hardcode filename, creates it. how create variable name?


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -