This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
basepath = input("Please input your specific directory : ") | |
#input example C:\Users\John\Downloads\ | |
for entry in os.listdir(basepath): | |
if os.path.isfile(os.path.join(basepath, entry)): | |
print(entry) |