Skip to content

Instantly share code, notes, and snippets.

View mmaul8's full-sized avatar
:octocat:
Tersesat

Muhammad Maulana mmaul8

:octocat:
Tersesat
View GitHub Profile
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()
@mmaul8
mmaul8 / python-reader.py
Created January 20, 2020 10:07
This script to read the name of all files in a directory
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)