I try to delete from text file those characters '{a}' '{b}' ... and so on (i have 250 curly braces in the text file) using this code:
because the letters change in every curly brackets i used asterisk in the,
but after i run this code nothing change in the text file:
>>> =============== =============== == RESTART =============== =============== ==
>>>
>>>
Code:
# -*- coding: cp1255 -*- import sys,codecs,string reload(sys) sys.setdefaultencoding('utf8') root = r"G:\desktop\y\test2.txt" x = open(root) s=x.read().replace('{*}','').replace('-','') x.close() x=open(root,"w") x.write(s) x.close
but after i run this code nothing change in the text file:
>>> =============== =============== == RESTART =============== =============== ==
>>>
>>>
Comment