I am a beginner to programming, and I have started to learn Python. I am trying to create a search and replace application, which allows us to select a number of files and then replaces the words or phrases that we want.
I have already written that script, but I want to make something which works in Windows XP. Actually I want it to be a GUI application that works in Windows. So what am I supposed to do? Here's the code that I have written:
#replace.py
import string
def main():
filez = raw_input("which files do you want processed?")
f=open(filez,"r")
data=f.read()
w1=raw_input("what do you want to replace?")
w2= raw_input("what do you want to replace with?")
print data
data=data.replace(w1,w2)
print data
f=open(filez,"w")
f.write(data)
f.close()
main()
Python has quite a few gui options, these in my mind are the most prolific.
since you said your a beginner I'd recommend using Tkinter as it comes built into python. Here is a tutorial to get you started.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With