By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,797 Members | 1,262 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,797 IT Pros & Developers. It's quick & easy.

this code replace text in a uni-code file

P: 1
This works, but I'd like to know peoples opinions.


with open ("readme.txt","r") as file:
fl=file.readlines()
fl[:] = [s.replace('xxxx', '.....') for s in fl]
with open("readme.txt","w") as file:
file.write("".join(fl))

thanx
anwar
Dec 18 '18 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.