[Tutor] deleting CR within files
David Talaga
dtalaga at novodynamics.com
Sat Apr 17 11:47:34 EDT 2004
Skipped content of type multipart/alternative-------------- next part --------------
import os
import Tkinter
import sys
import dialog
root=Tkinter.Tk()
result = 0
def doDialog():
global result
result = dialog.dialog()
f=Tkinter.Button(root, text="Find Files", command=doDialog)
f.pack()
x=Tkinter.Button(root, text="Close", command=sys.exit)
x.pack()
if f:
fileName=dialog.dialog()
in_file = open(fileName,'r').readlines()
out_file = open(fileName + '_cleaned', 'w')
for i in dialog().readline:
in_file
out_file.write(i[:-1] + '\n')
print 'File cleaned'
in_file.close()
out_file.close()
print filename
root.mainloop()
-------------- next part --------------
from Tkinter import *
import tkFileDialog
import sys
def dialog():
top = Tk()
top.withdraw()
initDir = 'C:/windows/desktop'
filetype = [('All files', '.*')]
fileName = tkFileDialog.askopenfilename(initialdir=initDir, filetypes=filetype)
return fileName
More information about the Tutor
mailing list