Skip to content

Instantly share code, notes, and snippets.

@mmaul8
Created January 21, 2020 03:46
Show Gist options
  • Save mmaul8/5dfcad28e6e43e93636a77563a49612b to your computer and use it in GitHub Desktop.
Save mmaul8/5dfcad28e6e43e93636a77563a49612b to your computer and use it in GitHub Desktop.
file = input("Input your file name coreectly : ")
#Input your file name with extention, example : file.txt
#It will work when you use it on same directory of your file
bef = input("What text you want to replace? ")
aft = input("Input your new text : ")
fin = open(file, "rt")
data = fin.read()
data = data.replace(bef,aft)
fin.close()
fin = open(file, "wt")
fin.write(data)
fin.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment