[Tutor] Need help appending data to a logfile
Matt D
md123 at nycap.rr.com
Thu Jun 27 16:36:36 CEST 2013
>
> You asked about a "save-as" feature. Why isn't that as simple as
> copying the current contents of the saved csv file? Or do you not know
> how you would go about copying?
>
Hi. So I have the logger working, meaning the correct data is being
written to the 'internal' file 'logfile.txt' which is opened like this:
self.logfile = open('logfile.txt', 'a')
And I have the button that starts the file dialog like this:
#open file dialog -----------------------------
def openFile(self, evt):
with wx.FileDialog(self, "Choose a file", os.getcwd(), "",
"*.*", wx.OPEN) as dlg:
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
mypath = os.path.basename(path)
with open(mypath, "a") as f:
Is there a simple way to copy what is in the 'internal' logfile.txt to
the file that the user chooses from the button?
Thanks!
More information about the Tutor
mailing list