424,054 Members | 1,044 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,054 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
4 Weeks Ago #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.